Flex keeps every display object off the stage until fully baked 
(applicationComplete event).  It speeds up initialization a bit.  During that 
time, any UIComponent hooked up to the Application in some way can get to the 
stage via systemManager.stage

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Hoff
Sent: Friday, December 05, 2008 10:50 AM
To: [email protected]
Subject: [flexcoders] Re: Accessing Stage from Class


If your class is a component, you may have to listen for the ADDED_TO_STAGE 
event, before you can reference the stage and add things like keyboard event 
listeners:

public function MyComponentClass()
{
     super();

     addEventListener( Event.ADDED_TO_STAGE, onAddedToStage );
}

-TH

--- In [email protected], "valdhor" <[EMAIL PROTECTED]> wrote:
>
> The Stage object is not globally accessible. You need to access it
> through the stage property of a DisplayObject instance.
>
> If your class has access to a DisplayObject use it. Else, pass it.
>
>
>
> --- In [email protected], "Dale Fraser" dale@ wrote:
> >
> > I have several classes that need access to the stage.
> >
> >
> >
> > How can classes access the stage, do I need to pass it, or is there
> a built
> > in method.
> >
> >
> >
> > Regards
> >
> > Dale Fraser
> >
>

Reply via email to