/ Published in: ActionScript 3
Use this to test if the stage exists before you execute a function (usually some sort of init). This is useful if you have items that need to be drawn onto the stage (displayObjects) before something else happens.
Expand |
Embed | Plain Text
// stick this code in the constructor of your class if (stage) { init (); } else { addEventListener (Event.ADDED_TO_STAGE, init); } // then use this code for an init function private function init (evt:Event = null):void { // something }
You need to login to post a comment.
