Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Welcome, Guest. Please login or register.
March 28, 2017, 02:34:35 PM
Home Help Search Login Register
News: ATTENTION: Spambots must die! Humans must visit http://contact.futurescale.com to request forum access.
Pages: [1]
Print
Author Topic: Help needed with FSM  (Read 2349 times)
ABloch
Newbie
*
Posts: 7


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

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 :
Code:
registerCommand( ApplicationConstants.STARTUP, StartupCommand );
            registerCommand( ApplicationConstants.STARTED, PreloaderCommand );
registerCommand( ApplicationConstants.PLUMBING,     PlumbCommand );
            registerCommand( ApplicationConstants.ASSEMBLE,  AssembleCommand );
            registerCommand( ApplicationConstants.FAIL,         FailCommand );
in InjectFSMCommand.as :
Code:
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 :
Code:
[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 AM »

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
Jump to: