As3 Events - Type of coercion failed?

I am sending events from a child to the parent swf. It worked fine until I used preloader swf to load the parent, and then the parent stopped receiving events from the child. I am getting this error now:

TypeError: Error #1034: Type Coercion failed: cannot convert com.company.events::MyCustomEvent@22494251 to com.company.events.MyCustomEvent.
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()

What does it mean? And why does this only happen when I wrap the main swf in the bootloader? Thanks for any help - I'm desperate!

+3
source share
2 answers

Sounds like a ApplicationDomain problem.

Try something like this:

public function loadSWF(url:String):void 
{
    var req:URLRequest = new URLRequest(url);
    var cxt:LoaderContext = new LoaderContext();
        cxt.applicationDomain = ApplicationDomain.currentDomain;

    var ldr:Loader = new Loader();
        ldr.load(req, cxt);
}
+4
source

Why is event processing interrupted when wrapping around the main swf in the bootloader?

""... , swf, , swf - , - , , .

, , . .

+1

Source: https://habr.com/ru/post/1717527/


All Articles