views:

16

answers:

1

Hello,

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 in the activity window in safari etc?

+1  A: 

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

Cadin