Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Flex, what's the difference between 'creationComplete' and 'addedToStage'?

I want to count (via google analytics) the times a pop-up is displayed to the user. Which event should I use to deduce that the pop-up is being displayed to the user?

like image 722
Hisham Avatar asked Dec 04 '09 01:12

Hisham


1 Answers

If a new pop up is created every time you display one, it doesn't matter which one you use as both events will be fired upon creating. If you are reusing the same object, you should use addedToStage as creationComplete is dispatched only once per UIComponent.

  • creationComplete is dispatched when the component, and all of its child components, and all of their children, and so on have been created, laid out, and are visible.
  • addedToStage 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.

So if you are reusing the same object, you will get an addedToStage every time you display it.

like image 79
Amarghosh Avatar answered Sep 19 '22 00:09

Amarghosh