Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Help needed with FSM  (Read 8377 times)
ABloch
Newbie
*
Posts: 7


View Profile Email
« on: June 07, 2012, 03:11:06 »

Hi,
I'm trying to set up a Finite State Machine in my multicore app, but it seems a bit tricky for me.
So far, here is what I have done (code from example) :
in my ApplicationFacade.as :
:
registerCommand( ApplicationConstants.STARTUP, StartupCommand );
            registerCommand( ApplicationConstants.STARTED, PreloaderCommand );
registerCommand( ApplicationConstants.PLUMBING,     PlumbCommand );
            registerCommand( ApplicationConstants.ASSEMBLE,  AssembleCommand );
            registerCommand( ApplicationConstants.FAIL,         FailCommand );
in InjectFSMCommand.as :
:
var fsm:XML =
            <fsm initial={ApplicationConstants.STARTUP}>
           
                <!-- STARTUP THE SHELL -->
                <state name={ApplicationConstants.STARTUP}>

                   <transition action={ApplicationConstants.STARTED}
                                  target={ApplicationConstants.PLUMBING}/>

                   <transition action={ApplicationConstants.STARTUP_FAILED}
                                  target={ApplicationConstants.FAILING}/>
                </state>
But when I trace my events, I only get this :
:
[Starting debug session with FDB]
ApplicationFacade.initializeController()
ApplicationFacade.sendNotification( note/startup [object Stage] null )
ApplicationFacade.sendNotification( StateMachine/notes/action null null )
InjectFSMCommand
ApplicationFacade.sendNotification( StateMachine/notes/changed [object State] note/startup )
I know I will sound quite noob with my question, but I don't get why the transition action and target from <state name={ApplicationConstants.STARTUP}> are not triggered?
TIA,
Cyrill
Logged
ABloch
Newbie
*
Posts: 7


View Profile Email
« Reply #1 on: June 07, 2012, 04:48:18 »

ok, I think I got why it didn't work : in my StartupCommand.as, the two subCommands :
            addSubCommand( InjectFSMCommand );
            addSubCommand( StartShellCommand );   
were in the wrong order... Now that it is this way, it seems to work better.
Logged
Pages: [1]
Print