gpt4 book ai didi

flash - as3 事件 - 类型强制失败?

转载 作者:行者123 更新时间:2023-12-01 12:01:08 26 4
gpt4 key购买 nike

我正在将事件从 child 发送到父 swf。它工作正常,直到我使用预加载器 swf 加载父项,然后父项停止从子项获取事件。我现在收到此错误:

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 包装在加载程序中时才会发生?感谢您的帮助 - 我很绝望!

最佳答案

听起来像是 ApplicationDomain 问题。

尝试这样的事情:

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);
}

关于flash - as3 事件 - 类型强制失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1415722/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com