由网友(无可救药の爱恋′)分享简介:我派遣从子事件到父SWF。它工作正常,直到我用了preloader SWF加载父,然后父停止获取从孩子的事件。现在我得到这个错误:I am dispatching events from a child to a parent swf. It was working properly, until I used a...
我派遣从子事件到父SWF。它工作正常,直到我用了preloader SWF加载父,然后父停止获取从孩子的事件。现在我得到这个错误:
I am dispatching events from a child to a parent swf. It was working properly, until I used a preloader swf to load the parent, then the parent stopped getting events from the child. I get 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()
这是什么意思?为什么它只是发生在我包装在一个装载机主SWF?感谢您的帮助 - 我绝望
What does that mean? And why does it only happen when I wrap the main swf in a loader? Thanks for any help - I'm desperate!
推荐答案
听起来像是一个ApplicationDomain的问题。
Sounds like an ApplicationDomain issue.
尝试是这样的:
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);
}
相关推荐
最新文章