SignalExecutorMap – Another way to map AS3-Signal to Command in Robotlegs
I love both Robotlegs and AS3-Signals so much, and many thanks to Joel Hooks's SignalCommandMap, they work together great now. When I saw [Execute] tag in dawn I thought if I can do its way for SignalCommand. So, Here is my SignalExecutorMap. I used it in a simple slide player for my Robotlegs slides.
To use it, put the same count and type of params in the execute() method of the Command as its trigger Signal.
// The signal in SignalBus: public const turnToPageRequested:Signal = new Signal(int); |
// Execute method in Command: public function execute(index:int):void |
// Dispatch the signal signalBus.turnToPageRequested.dispatch(0); |
It's not a common solution, because it eliminates the possibility of using other Command impls already in existence. So I created it as SignalExecutorMap instead of expanding SignalCommandMap, and just leave it a single class for personal use. I shared it just in case somebody want it like me because:
- 1, By now (until Robotlegs 1.1) SignalCommandMap will unmap the value passed by Signal.
- 2, Don't want to inject base type like
[Inject] public var index:int;
- 3, Don't want to create VO class just for being passed by Signal to avoid 1 and 2.
I'm sure SignalCommandMap will get better with Robotlegs 1.1 and better later. Robotlegs and as3-signals, they were born to work together ![]()
-
http://kevincao.com kyoji
-
http://kevincao.com kyoji
-
http://eidiot.net/en/ eidiot
-
BrainstormWilly


