I have this code :
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
when is this event called ? I'm working on a example project of StageVideo but it isn't easy. I'm working on flash pro.
I have this code :
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
when is this event called ? I'm working on a example project of StageVideo but it isn't easy. I'm working on flash pro.
On
As indicated by its name, the addedToStage event is
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. The following methods trigger this event: DisplayObjectContainer.addChild(), DisplayObjectContainer.addChildAt().
Hope that can help.
Event.ADDED_TO_STAGEis called wheneveraddChild()oraddChildAt()is called.In order to make sure that the stage and parent are available within the object that is being added to the stage that you add the listener of
Event.ADDED_TO_STAGEwithin the object's constructor and then when that object is added to the stage, itsEvent.ADDED_TO_STAGElistener will be fired and the stage and parent of that object will be available.Example:
Output: