如何使用我的代码在 Event.COMPLETE 之后取回加载程序? (as3、闪存)
您能告诉我在 Event.COMPLETE 之后如何恢复加载程序吗?
我尝试了文档中的示例,我尝试了不同的东西,但我总是遇到“在 LoaderInfo 或 myImport 中转换 Loader 时出错...”
这不起作用: TypeError: Error #1034:
function loader_my_import(){
var loader = new Loader();
var url:URLRequest = new URLRequest("myImport.swf");
loader.load(url);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete_imgs);
}
function complete_imgs(e:Event){
loader_IMGS = Loader(e.target.content);
}
loader_IMGS 已在类的开头声明。
谢谢
can you please tell me how you get the loader back after a Event.COMPLETE?
i tried the example from the doc, i tried different stuff, but i always have a "error to convert Loader in LoaderInfo, or in myImport..."
this does not work : TypeError: Error #1034:
function loader_my_import(){
var loader = new Loader();
var url:URLRequest = new URLRequest("myImport.swf");
loader.load(url);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete_imgs);
}
function complete_imgs(e:Event){
loader_IMGS = Loader(e.target.content);
}
loader_IMGS being already declared at the beginning of the class.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它不起作用,因为 e.target 是 LoaderInfo 对象不是加载程序(您将事件监听器添加到 contentLoaderInfo )。然后,您可以从 LoaderInfo 获取源 loader
所以应该是:
It doesn't work because e.target is a LoaderInfo object not a loader (you add the event listener to the contentLoaderInfo ). From the LoaderInfo you can then get the originate loader
So it should be :