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?
views:
897answers:
3
A:
From my own testing, it looks like using either would work. But it would be nice to know which is the more 'correct' one to use, and just what the difference is between the two.
Hisham
2009-12-04 01:56:28
+5
A:
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.
Amarghosh
2009-12-04 05:03:14
A:
The first addedToStage event occurs before creationComplete so if you need to access child components you'll need to use both.
gharley
2010-03-10 17:27:07