PDA

View Full Version : Custom Event conflict between swfs (Error 1034)



StridBR
September 8th, 2009, 03:25 PM
I'm using a custom event (HotEvent) to make the communication between a loaded swf and its container, but im getting some strange error if i set the event handler parameter type:




TypeError: Error #1034: Type Coercion failed: cannot convert globals::HotEvent@32e5761 to globals.HotEvent.
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at flash.events::EventDispatcher/dispatchEvent()
at wallpaper.view::Wallpaper/wallpaper.view:Wallpaper::closeBtnHandler()
it works fine i dont type the handler function, like this:



private function sectionCloseHandler(e:*):void {
}


any ideas on how to solve this conflict?

wvxvw
September 8th, 2009, 03:38 PM
You have 2 globals.HotEvent classes in different sandboxes. Either load the SWF into the sandbox where this class is present, or get the event type at runtime from the foreign sandbox (however, in later case you will loose precise typing ability).

BTW. One more thing to try... never tried that myself, but may work as well... Try registerClassAlias("globals.HotEvent", HotEvent) in both SWFs...

StridBR
September 8th, 2009, 04:45 PM
Just got it fixed

I'm using BulkLoader so i got a bit confused on how to set the applicationDomain, but BulkLoader provides a very simple interface for this:



var myContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);


setting context for loaded content:



bulkLoader.add(Config.SWF_WALLPAPER, { context:myContext} );




Thank you for your attention!