/ Published in: MXML
There are times when you need to access the stage property before onCreationComplete. Here are two ways to do it.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/*********************** Method 1: On Added handler ***********************/ addEventListener( Event.ADDED_TO_STAGE, function( e:Event ):void { stage.addEventListener( MouseEvent.MOUSE_MOVE, myMouseMoveEvent ); }); /*********************** Method 2: The system manager parents all displayable elements within the Flex application. ***********************/ systemManager.stage.addEventListener( MouseEvent.MOUSE_MOVE, myMouseMoveEvent );
URL: http://www.alwaysgetbetter.com/blog/2008/11/09/accessing-the-stage-in-flex/