View Full Version : Creation-time Application Event: Stage Object Available

07-28-2006, 03:54 AM
Hi, all,

I was searching for an event dispatched to an mx.core.Application at such a time when the Application has been added to the Display List and the Stage object was available for it (I wanted to register some listeners with the stage object). After trying several UIComponent events:

* "add" is dispatched when the component is added to the display list. However, the stage is not available yet as the display list is not yet redrawn.
* "initialize" is dispatched after that, when the component "has finished its construction. The stage is not available yet.
* "creationComplete" is dispatched after that, when the component has finished its everything. And still, the stage is not available.

I finally found the following Application event:
* "applicationComplete": That's the one I was looking for! The stage object is available.

07-28-2006, 02:46 PM
Also see:

07-28-2006, 11:33 PM
Hi, senocular! I foresee some confusion as Flex 2 classes redefine some core AS3 behaviors (e.g., getChild()). So, I guess we always have to be very clear if Flex is being used in the scope of the discussion or not... :)

flash.events.Event.ADDED is "dispatched to a DisplayObject when it is added to the Display List" (AS3 LangRef). As opposed to the mx.events.FlexEvent.ADD, which is "Dispatched when the component is added to a container as a content child by using the addChild() or addChildAt() method." (Flex 2 LangRef). Ahha! Not the same thing at all, is it! :)

07-28-2006, 11:40 PM
I have no idea. anything mx... is part of the AS-based mx framework of which I am not familiar. Everything else (flash...) is specific to the player and would be what anything mx... is based on anyway.

I'm actually working on a different version of what I posted above - one which is a little more resilliant.

07-28-2006, 11:47 PM
Wait, what is the "mx framework"? I assumed that all the mx.* packages are simply part of the Flex 2 Libraries. What you are saying is that there is another layer, called "mx framework", interposed between the core AS3 and Flex 2?

You moved to SF, I see :) How do you like it?

07-29-2006, 12:20 AM
by "mx framework" I mean any of the mx classes. Flex is based off of them but they are not specific to Flex. The thing is they are also written in ActionScript so there is nothing about mx that you couldn't do yourself, and maybe even better and more efficiently. I dont know if the Tween thing was asked here, but the mx tween with the mx framework provided with Flex is a beast.

You moved to SF, I see :) How do you like it?
I've been here for a few months ;) Its ok. It has its ups and downs. Don't know yet if I'm going to stay long.

07-29-2006, 04:01 PM
Right, that's a good way to think about them - the mx.* libraries are there, they implement a certain functionality, we can either use them, or use a 3rd party implementation of the same functionality, or implement it ourselves. The source is distributed with them as well, I believe (at least, in Flex Builder 2 you can hit f3 to view source of a library class).

For the built-in flash classes that's true too, I suppose, to a certain extent, but I guess you are saying that not all of them are pure AS, and sometimes refer directly to internal VM structures as an optimization.

It has its ups and downs.
Especially Lombard st. :D