AS3 - 添加预加载器 swf 后不再接收事件
这是我最初的结构: 主.swf -> child.swf
主要加载各种子 swf。我正在从子 swf 中调度事件,而 main 正在监听这些事件。一切都运转良好。
然后,我添加了一个预加载器swf,所以现在的结构是: 加载程序.swf ->主.swf -> child.swf
我根本没有改变 main 和 child 之间的关系,但是现在 main 不再接收 child 调度的事件。我知道他们正在被调度(使用 Console.log)。冒泡设置为 true。为什么仅仅因为我用加载器包装了所有内容, main 就不再接收来自子进程的事件?
编辑: 我尝试将 useWeakReference 更改为 false,以防侦听器被垃圾收集:
this.addEventListener(MyEvent.HELP_ME, imDesperate, false, 0, false);
这没有任何区别。
This was my initial structure:
main.swf -> child.swf
Main loads various child swfs. I am dispatching events from the child swfs, and main is listening for the events. Everything was working great.
Then, I added a preloader swf, so now the structure is:
loader.swf -> main.swf -> child.swf
I did not change the relationship between main and child at all, but now events dispatched by the child are no longer received by main. I know they are getting dispatched (using Console.log). Bubbling is set to true. Why would main no longer receive events from a child just because I wrapped everything with a loader?
EDIT:
I tried changing useWeakReference to false, in case the listener was getting garbage collected:
this.addEventListener(MyEvent.HELP_ME, imDesperate, false, 0, false);
That didn't make any difference.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了其他访问此问题的人的利益,答案与 ApplicationDomain 有关(概述 此处)并在此处解决。
For the benefit of others visiting this question, the answer is to do with the ApplicationDomain (overview here) and was solved here.