AS3 Loader Class - Load Silenty & Error
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
精彩评论