Skip to content

Instantly share code, notes, and snippets.

@mizutanikirin
Created August 17, 2015 11:31
Show Gist options
  • Save mizutanikirin/b5b21944ae5374da13eb to your computer and use it in GitHub Desktop.
Save mizutanikirin/b5b21944ae5374da13eb to your computer and use it in GitHub Desktop.
package {
import flash.display.MovieClip;
import flash.events.Event;
public class SomeClass extends MovieClip {
public function SomeClass(){
super();
if (stage) init(null);
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(evt:Event) : void {
if (evt != null)
removeEventListener(Event.ADDED_TO_STAGE, init);
trace (stage.stageWidth);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment