Skip to content

Instantly share code, notes, and snippets.

@hyakugei
Forked from darscan/RobotlegsAsyncCommand.as
Created February 18, 2010 16:10
Show Gist options
  • Save hyakugei/307781 to your computer and use it in GitHub Desktop.
Save hyakugei/307781 to your computer and use it in GitHub Desktop.
package org.robotlegs.extensions.mvcs
{
import flash.utils.Dictionary;
import org.robotlegs.base.EventMap;
import org.robotlegs.core.IEventMap;
import org.robotlegs.mvcs.Command;
public class AsyncCommand extends Command
{
protected static var _commands:Dictionary = new Dictionary();
protected var _eventMap:IEventMap;
public function AsyncCommand()
{
_commands[this] = true;
}
public function finish():void
{
if (_eventMap) _eventMap.unmapListeners();
delete _commands[this];
}
protected function fork(commandClass:Class):void
{
injector.instantiate(commandClass).execute();
}
protected function get eventMap():IEventMap
{
return _eventMap || (_eventMap = new EventMap(eventDispatcher));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment