function Main(){ if(stage){ init(); }else{ addEventListener(Event.ADDED_TO_STAGE, init); } } function init(e:Event = null):void{ removeEventListener(Event.ADDED_TO_STAGE, init); trace(stage); }