Skip to content

Instantly share code, notes, and snippets.

@the1sky
Forked from darscan/RobotlegsAsyncCommand.as
Created March 28, 2012 04:21
Show Gist options
  • Save the1sky/2223590 to your computer and use it in GitHub Desktop.
Save the1sky/2223590 to your computer and use it in GitHub Desktop.
An Async Command for Robotlegs
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