07
Jan
08

When is stage available?

I’m not sure if anyone else has run into this…. So for some reason, when writing Flex apps I have been relying on the creationComplete event to initialize my application, but at the time that event fires off the stage is not available yet. I found out there is an applicationComplete event, and after this event is fired off the stage is available.


1 Response to “When is stage available?”


  1. 1 Jeff Aug 27th, 2008 at 10:10 am

    If the code to be executed only has the requirement that the object has been added to the stage, an alternative is to add a listener for the Event.ADDED_TO_STAGE to occur. Example:


    public class MyClass extends Canvas
    {
    import flash.events.Event;
    import mx.containers.Canvas;

    public function MyClass()
    {
    super();

    this.addEventListener( Event.ADDED_TO_STAGE, this.addedToStageHandler );
    }

    private function addedToStageHandler( e:Event ):void
    {
    /* do something */
    }
    }

Leave a Reply