Access stage instance in Flex/AIR/Flash

By maohao

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”

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

Leave a Reply