I’m trying to trigger the completeHandler function when the loader is done loading IMG1.jpg. I know the rest of the code is sound, because if I move the code from the function to the main it works.
So, what am I doing wrong?
import flash.display.Sprite;
import flash.events.Event;
var logo:Sprite = new Sprite();
var loader = new Loader();
loader.load(new URLRequest("IMG1.jpg"));
loader.addEventListener(Event.COMPLETE, completeHandler);
function completeHandler(event:Event):void {
logo.addChild(loader);
addChild(logo);
}
Thank you in advance guys!