1. private var _callLater : Dictionary = new Dictionary(true);
  2.  
  3. public function callLater(method : Function, args : Array = null) : void {
  4. _callLater[method] = args;
  5. // If app supposes to use graphics, change it to ENTER_FRAME
  6. this.addEventListener(Event.EXIT_FRAME, onCallLater);
  7. }
  8.  
  9. private function onCallLater(event : Event) : void {
  10. // If app supposes to use graphics, change it to ENTER_FRAME
  11. this.removeEventListener(Event.EXIT_FRAME, onCallLater);
  12. for ( var f : Object in _callLater ) {
  13. ( f as Function ).apply(undefined, _callLater[f]);
  14. delete _callLater[f];
  15. }
  16. }