Hi Everyone!
What is the correct event listener to detect a child added to the stage?
I tried:
function loadImage(url:String):void
{
imageLoader = new Loader();
imageLoader.load(new URLRequest(url));
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
imageLoader.contentLoaderInfo.addEventListener(Event.ADDED, traceLoad);
}
loadImage("test.jpg");
function imageLoaded(e:Event):void
{
imageArea.addChild(imageLoader);
}
function traceLoad(e:Event):void
{
trace("l")
}
…which doesn’t work. I also tried ADDED_TO_STAGE but that doesn’t fire it either. Do you know the correct way to detect when the child is added? Perhaps I should be attaching the listener to the parent instead?
Thanks in advance, I haven’t been able to find a solution for this.
Ryan