简体   繁体   English

AS3加载程序类-静默加载和错误

[英]AS3 Loader Class - Load Silenty & Error

I'm using the as3 loader class as follows: 我正在使用as3加载程序类,如下所示:

var l:Loader = new Loader();
l.addEventListener(Event.COMPLETE, onComplete);
l.load(new URLRequest(e.target.data));

function onComplete(e:Event){
addChild(e.target.content);
}

But it's not loading???? 但是没有加载吗????

I've imported the loader class, and it works without the event listener but not with it. 我已经导入了loader类,它可以在没有事件监听器的情况下工作,但不能与之一起工作。

Also, is it possible to load something silently? 另外,是否可以无声加载某些内容? EG so it does not appear as loaded in the activity window in safari etc? EG,这样它就不会在野生动物园等活动窗口中显示为已加载?

Don't attach the COMPLETE listener to the loader. 不要将COMPLETE侦听器附加到加载程序。 Attach it to the contentLoaderInfo property of your loader. 将其附加到加载程序的contentLoaderInfo属性。 In your case: 在您的情况下:

l.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);

Check out the example on LiveDocs: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html#includeExamplesSummary 在LiveDocs上查看示例: http : //livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html#includeExamplesSummary

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM