/ Published in: ActionScript 3
The point of this listener is to detect when something has been added to the stage. Purely experimental.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function onAdded(e:Event):void { // get reference to child from event object // as child variable of target will not yet be defined var childRef:MovieClip = e.target as MovieClip; trace(childRef.type + " " + stage.numChildren); // check the name of the reference for correct instance name if (childRef && childRef.name == "child"){ e.target.removeEventListener(Event.ADDED, onAdded); } } //stage.addEventListener(Event.ADDED, onAdded);