Flex: Accessing the stage


/ Published in: MXML
Save to your folder(s)

There are times when you need to access the stage property before onCreationComplete. Here are two ways to do it.


Copy this code and paste it in your HTML
  1. /***********************
  2. Method 1: On Added handler
  3. ***********************/
  4. addEventListener( Event.ADDED_TO_STAGE, function( e:Event ):void
  5. {
  6. stage.addEventListener( MouseEvent.MOUSE_MOVE, myMouseMoveEvent );
  7. });
  8.  
  9. /***********************
  10. Method 2: The system manager parents all displayable elements within the Flex application.
  11. ***********************/
  12. systemManager.stage.addEventListener( MouseEvent.MOUSE_MOVE, myMouseMoveEvent );

URL: http://www.alwaysgetbetter.com/blog/2008/11/09/accessing-the-stage-in-flex/

Report this snippet


Comments


You need to login to view comments.