views:

137

answers:

1

Basically, I'm trying to open/close a TitleWindow using PopUpManager.addPopUp() and PopUpManager.removePopUp() while reusing the same TitleWindow instance. I noticed that the creationComplete() is only called once for TitleWindow even if I open it several times and was wondering what events I should listen to for the succeeding popup loads.

A: 

creationComplete (FlexEvent.CREATION_COMPLETE) is fired only when the component is created; this happens only once since you are reusing the same component. Listen to added (Event.ADDED) or addedToStage (Event.ADDED_TO_STAGE) events if you want to do something every time a display object is displayed.

Amarghosh
Thanks. I noticed added() was being called, but it was being invoked several times while the popup is showing. I only called addPopUp once though. It might be worth mentioning that I also have a DataGrid whose data is refreshed every 10 seconds by a Timer but I don't think that should cause the add() event to be called more than once. I'll try the addedToStage() event and see how it works.
paul_sns
I don't think I'll be able to verify the addedToStage event as we already modified our approach (we just instantiated a new TitleWindow every time we opened a popup to make things simpler). But I'll accept this answer anyway. Thanks Amarghosh.
paul_sns
If you are instantiating new `TitleWindow` every time, you can use either `creationComplete` or `addedToStage`.
Amarghosh
Thanks I'm currently using creationComplete. ;)
paul_sns