Access stage instance in Flex/AIR/Flash

In Adobe AIR:

If you want to access stage instance from the start-up of your application (usually to do some set-up stuff), you could access it with the “windowComplete” event for the WindowApplication tag (equivalent of “applicationComplete” for Application tag for Flash Player application), like so:

<mx:WindowedApplication xmlns:mx=”http://www.adobe.com/2006/mxml&#8221;

windowComplete=”initApp()”>

….

private function initApp():void
{
this.stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
this.stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
}

In Flex (targetting Flash Player):

I believe you could do so within a “applicationComplete” handler.

In Flash:

Stage Access/Outside In

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: