开发者

AS3 Loader Class - Load Silenty & Error

开发者 https://www.devze.com 2023-01-22 10:02 出处:网络
I\'m using the as3 loader class as follows: var l:Loader = new Loader(); l.addEventListener(Event.COMPLETE, onComplete);

I'm using the as3 loader class as follows:

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.

Also, is it possible to load something silently? E.G so it does not appear as loaded i开发者_如何转开发n the activity window in safari etc?


Don't attach the COMPLETE listener to the loader. Attach it to the contentLoaderInfo property of your loader. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消