/ Published in: ActionScript 3

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package { import flash.events.Event; public class MyClass extends MovieClip { public function MyClass() { super(); addEventListener(Event.ADDED_TO_STAGE,added); // stage is null; try trace(stage.stagewidth); ==> null object } public function added(evt:Event):void{ removeEventListener(Event.ADDED_TO_STAGE,added); // stage is not null; try trace(stage.stagewidth); ==> somevalue } } }
Comments
