This content has been marked as final. Show 4 replies
addChild is immediate. You can call functions anytime.
In fact, you can call functions on the child before you call addChild. The instance is created when you do new.
There are the following events you could listen to:
Dispatched when a display object is added to the display list.
Dispatched when a display object is added to the on stage display list, either directly or through the addition of a sub tree in which the display object is contained.
var numberOfChildren:uint = componentName.numChildren;
componentName.getChildIndex(child'sName); //If this returns -1, the child is not there.
if(componentName.getChildByName(child'sName) != null)...
if(componentName.getChildren().toString().indexOf(child'sName) != -1)...
If you want to know for sure if the child is really in there! After checking, if true, then call a function, else, return.
If you want to know when a content child has been added, listen for;
The event.releatedObject will contain the instance that fired the event. The currentTarget is the parent that just added the new child.
The added event gets dispatched by the player and gets called for 'every' display list addition to the component, chrome and content children.