Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (_myComponent != null)
- {
- // add listeners
- }
- if (mcWithComponents.stage) doStuff();
- mcWithComponents.addEventListener(Event.ADDED_TO_STAGE, doStuff);
- private function doStuff(e:Event = null):void
- {
- mcWithComponents.myButton.addEventListener(MouseEvent.CLICK, buttonClicked);
- }
- public function mcWithComponents() // constructor
- {
- if (stage) init();
- addEventListener(Event.ADDED_TO_STAGE, init);
- }
- private function init(e:Event = null):void
- {
- myButton.addEventListener(MouseEvent.CLICK, buttonClicked);
- }
Add Comment
Please, Sign In to add comment