Created
January 17, 2011 18:51
-
-
Save squeedee/783251 to your computer and use it in GitHub Desktop.
Robotlegs Sequencer Actor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.visfleet.robotlegs.bootstrap { | |
import org.robotlegs.core.ICommandMap; | |
import org.robotlegs.core.IReflector; | |
import org.robotlegs.mvcs.Actor; | |
public class AbstractSequencer extends Actor { | |
private var steps:Array = new Array(); | |
[Inject] | |
public var reflector:IReflector; | |
[Inject] | |
public var commandMap:ICommandMap; | |
[PostConstruct] | |
public function postConstruct():void { | |
configure(); | |
} | |
virtual protected function configure():void { | |
throw new Error("Override " + reflector.getFQCN(this) + "#configure and don't call super", 8725414); | |
} | |
protected function addStep(commandClass:Class):void { | |
var classFQN:String = reflector.getFQCN(commandClass); | |
steps.push(classFQN); | |
commandMap.mapEvent(classFQN,commandClass,SequenceStepEvent,true); | |
} | |
public function step():void { | |
if (!stepsRemain()) | |
return; | |
executeNextStep(); | |
} | |
private function executeNextStep():void { | |
var classFQN:String = steps.shift(); | |
var event:SequenceStepEvent = new SequenceStepEvent(classFQN, this); | |
dispatch(event); | |
} | |
public function stepsRemain():Boolean { | |
return steps.length > 0; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.visfleet.robotlegs.bootstrap { | |
import flash.events.Event; | |
public class SequenceStepEvent extends Event { | |
public function SequenceStepEvent(classFQN:String, sequencer:AbstractSequencer) { | |
super(classFQN); | |
this.sequencer = sequencer; | |
} | |
private var sequencer:AbstractSequencer; | |
public function step():void { | |
sequencer.step(); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConfigureScheduleHeaderViewCommand extends Command { | |
[Inject] | |
public var event:SequenceStepEvent; | |
override public function execute():void { | |
mediatorMap.mapView(TimelineView, TimelineMediator); | |
event.step(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's what I thought. Thank god the bad old days of the AVM1 are over.
And now I'm back to optimizing the performance of SwiftSuspenders ;)