Skip to content

Instantly share code, notes, and snippets.

View neilmanuell's full-sized avatar

neil manuell neilmanuell

View GitHub Profile
@neilmanuell
neilmanuell / MacroCommandSignal.as
Created February 4, 2011 12:02
the bastard child of a Signal and SignalCommadMap
public class MacroCommandSignal extends Signal
{
[Inject]
public var signalCommandMap:ISignalCommandMap;
public function MacroCommandSignal()
{
// allows a payload Object to be injected into each command
super( Object );
@neilmanuell
neilmanuell / IFSMProperties.as
Created February 25, 2011 11:03
Contract for FSMProperties wrapping IFSMController
public interface IFSMProperties
{
function get referringAction():String;
function get currentStateName():String;
function get transitionPhase():String;
function get isTransitioning():Boolean;
}
@neilmanuell
neilmanuell / FSMProperties.as
Created February 25, 2011 11:06
Limits the access of the IFSMController to its properties
import org.osflash.statemachine.core.IFSMController;
public class FSMProperties implements IFSMProperties
{
private var _fsmController:IFSMController;
[Inject]
public function set fsmController( value:IFSMController ):void
{
@neilmanuell
neilmanuell / BaseMacroAction.as
Created February 25, 2011 11:10
Base class for sending multiple synchronous actions
public class BaseMacroAction implements IActionable
{
private var _fsmController:IFSMController;
[Inject]
public function set fsmController( value:IFSMController ):void
{
_fsmController = value;
}
@neilmanuell
neilmanuell / LockDoor.as
Created February 25, 2011 11:16
Example implementation of a MacroAction
public class LockDoor extends BaseMacroAction
{
override protected function initiateMacroAction( payload:Object ):void
{
sendAction( ActionNames.CLOSE);
sendAction( ActionNames.LOCK, payload );
}
}
@neilmanuell
neilmanuell / InjectFSMProperties.as
Created February 25, 2011 11:40
Inject FSMProperties as IFSMProperties (Robotlegs)
injector.mapClass( IFSMProperties, FSMProperties )
@neilmanuell
neilmanuell / IActionable.as
Created February 25, 2011 11:13
Contract for BaseMacroAction
public interface IActionable
{
function action( payload:Object = null ):void
}
@neilmanuell
neilmanuell / LockDoorActionCall.as
Created February 25, 2011 12:40
Example of executing the Close MacroAction
[Inject(name="lockDoor")]
public var lockDoor:IActionable;
public function onClick( event:MouseEvent ):void{
lockDoor.action()
}
@neilmanuell
neilmanuell / LockedStateTransitionPhases.as
Created March 6, 2011 10:40
Pseudocode examples of Locked State transition phases
////////////////////////////////////////////
// exiting guard
if( !lock.isKeyValid( user ) ){
fsm.cancel( Reasons.KEY_INVALID );
}
////////////////////////////////////////////
////////////////////////////////////////////
// cancelled
if( reason == Reasons.KEY_INVALID ){
@neilmanuell
neilmanuell / custom_compiler_config.xml
Created March 13, 2011 09:24
example custom compiler confix xml for GuardedCommandMap
<flex-config xmlns="http://www.adobe.com/2006/flex-config">
<target-player>9.0.124</target-player>
<compiler>
<debug>true</debug>
<source-path>
<path-element>src</path-element>
</source-path>
<library-path append="true">
</library-path>
<external-library-path>