I dont think you are on the right track.
You send StateMachine.ACTION notification from application(command or mediator) to StateMachine which triggers a transition. No need to register commands with StateMachine.ACTION notification. You should add 'changed' property to each state.
<fsm initial={Main.STATE_READY}>
<state name={Main.STATE_READY} changed={Main.READY}>
<transition action={Main.ACTION_START} target={Main.STATE_PLAYING}/>
</state>
<state name={Main.STATE_PLAYING} changed={Main.PLAY}>
<transition action={Main.ACTION_PAUSE} target={Main.STATE_PAUSED}/>
<transition action={Main.ACTION_STOP} target={Main.STATE_STOPPED}/>
</state>
<state name={Main.STATE_PAUSED} changed={Main.PAUSE}>
<transition action={Main.ACTION_RESUME} target={Main.STATE_PLAYING}/>
</state>
<state name={Main.STATE_STOPPED} changed={Main.STOP}>
<transition action={Main.ACTION_RESET} target={Main.STATE_READY}/>
</state>
</fsm>;
Now your StateMachine sends notification(READY, PLAY, PAUSE, STOP) every time state is changed. If you need, you can register commands with these notifications or simply make mediator(s) to listen for them.
override protected function initializeController () : void
{
super.initializeController();
registerCommand( STARTUP, StartupCommand );
registerCommand( Main.READY, ReadyCommand );
registerCommand( Main.PLAY, PlayCommand );
registerCommand( Main.STOP, StopCommand );
registerCommand( Main.PAUSE, PauseCommand );
}
Look at the SOAMusicPlayer source code
http://seaofarrows.com/srcview/Mariush T.
http://mariusht.com/blog