Posted By

Empreintes on 10/20/10


Tagged

stage


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

sexyflash
weavermedia


get access to stage object


 / Published in: ActionScript 3
 

  1. package
  2. {
  3. import flash.events.Event;
  4.  
  5. public class MyClass extends MovieClip
  6. {
  7. public function MyClass()
  8. {
  9. super();
  10. addEventListener(Event.ADDED_TO_STAGE,added);
  11. // stage is null; try trace(stage.stagewidth); ==> null object
  12. }
  13.  
  14. public function added(evt:Event):void{
  15. removeEventListener(Event.ADDED_TO_STAGE,added);
  16. // stage is not null; try trace(stage.stagewidth); ==> somevalue
  17.  
  18. }
  19. }
  20. }

Report this snippet  

You need to login to post a comment.