PDA

View Full Version : Handling Displaying Event


KhaledK
05-28-2007, 07:45 PM
Hi all,

For somehow, I need to trigger the event that will be fired once the component displayed.

Lets take the following example:

root
|____comp1 (Panel)
|____comp2 (Panel)

root will be responsible about changing the states according to the event dispatched by either comp1 or comp2.

And if root changed the currentState into another one contains comp1, I want in this case comp1 to fire an event that indicate that comp1 now is visible for the user.

How can I do that?

I have tried "addedToStage" but not sure about it.

Thanks in advance.

flexy
05-31-2007, 09:32 AM
To be honest I would make use of the Flex ViewStack (http://livedocs.adobe.com/flex/201/langref/mx/containers/ViewStack.html) component, that can handle your varying views from you. From this you can exploit events such as IndexChangedEvent to respond to changes in the view.

Post about IndexChangedEvent:
http://www.flexdeveloper.eu/forums/YaBB.pl?num=1180103419/0#0

hangalot
05-31-2007, 10:33 AM
the viewstack also comes with delayed initilization, so just watch out for that, but once you have figured out how that works all is well :)