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.
views:
137answers:
1
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
2010-02-24 13:46:10
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
2010-02-24 14:15:02
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
2010-03-01 08:15:35
If you are instantiating new `TitleWindow` every time, you can use either `creationComplete` or `addedToStage`.
Amarghosh
2010-03-01 08:41:27
Thanks I'm currently using creationComplete. ;)
paul_sns
2010-03-01 09:16:55