As the doc says, an ADD event happens as a result of a call to addChild

 

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of gwangdesign
Sent: Friday, August 22, 2008 10:31 AM
To: [email protected]
Subject: [flexcomponents] Please: Help me understand "add"/"remove"
event

 

I am having a hard time understanding "add" and "remove" event for
UIComponents. What do they mean and when do they happen?

After testing in the debugging console, it seems for the same
component, the "add" event is dispatched before the "preintialize"
event. So I assume that an "add" event happens when Flex calls the
"addChild" to add the component to the DisplayList; similar story
happens for an "remove" event. But further investigation reveals that
if a Container with all its inner components is attached to an
"AddChild" node under a "State" node under one pass, its descendant
components "add" events happen before the container's "add" event. In
the following code, the "add" events for "tXt1" and "bTn1" happen
before the "add" event for the "vBx1":

<mx:State name="block">
<mx:AddChild>
<mx:VBox id="vBx1" width="100%" height="100%" add="addLog(event);"
remove="removeLog(event);">
<mx:Text id="tXt1" text="Hello world!" styleName="embFont"
add="addLog(event);" remove="removeLog(event);"/>
<mx:Button id="bTn1" label="Back" click="currentState=null"
styleName="embFont" add="addLog(event);" remove="removeLog(event);"/>
</mx:VBox>
</mx:AddChild>
</mx:State>

 

Reply via email to