为什么 loaderInfo 仅在 applicationComplete 触发后才可用?
在AS3项目中,我们可以在根类构造函数的第一行访问loaderInfo。这意味着整个 AS3 应用程序都可以利用 loaderInfo 对象。
然而,在 Flex 中,loaderInfo 对象似乎在发送 applicationComplete 事件之后才可用。这对我来说是有问题的,因为其他组件(需要利用 loaderInfo)在发送 applicationComplete 事件之前就已初始化。
我一定是错过了什么。谢谢大家的帮助! :)
In an AS3 project, we can access loaderInfo in the first line of the root class' constructor. This means that the entire AS3 application can take advantage of the loaderInfo object.
However, in Flex, it seems that the loaderInfo object is not available until after the applicationComplete event is sent. This is problematic for me, as other components (that need to leverage loaderInfo) are initialized long before the applicationComplete event is sent.
I must be missing something. Thanks for your help, everyone! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在Flex中使用Application.application.systemManager.stage.loaderInfo。
请参阅:http://www.actionscript.org/forums /showthread.php3?p=938460&posted=1#post938460
Use Application.application.systemManager.stage.loaderInfo in Flex.
See: http://www.actionscript.org/forums/showthread.php3?p=938460&posted=1#post938460
或者对于 Flex 4:
FlexGlobals.topLevelApplication.systemManager.stage.loaderInfo
Or for Flex 4:
FlexGlobals.topLevelApplication.systemManager.stage.loaderInfo
由于 applicationComplete 事件在应用程序布局添加到显示列表时发生,因此在此之前 stage 不可用。
Because the applicationComplete event occurs when the application layout is added to the displaylist, so until then stage is not available.