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: another statemachine question...  (Read 3824 times)
marcink
Jr. Member
**
Posts: 13


View Profile Email
« on: March 02, 2009, 09:01:30 »

is it possible to nest states?

say i have 4 states: state A, state B, state C and state D

when in state B, i'd like to have the possiblity to trigger state C and state D, but only if i'm in state B.
when i would try to trigger state C/D while the current state is A, nothing happens...

is that possible? or do i have to make a switch in the handleNotification function?

thanks
Logged
Neil Manuell
Courseware Beta
Sr. Member
***
Posts: 109


View Profile Email
« Reply #1 on: March 02, 2009, 03:46:10 »

consider this:

<fsm initial='A'>
    <state name='A'>
        <transition action='toB' target='B'/>
    </state>
    <state name='B'>
        <transition action='toC' target='C'/>
        <transition action='toD' target='D'/>
    </state>
    <state name='C'>
        <transition action='toA' target='A'/>
    </state>
    <state name='D'>
        <transition action='toA' target='A'/>
    </state>

</fsm>

if the state is B, you can go to C or D (be calling ACTION 'toC' or 'toD')
however in A calling these ACTIONS would do nothing. You would have to call 'toB' to change state, as the only legal state that you can go to from A is B

does that answer your question?

Logged
marcink
Jr. Member
**
Posts: 13


View Profile Email
« Reply #2 on: March 03, 2009, 04:32:57 »

hi neil,

yes, it is just to obvious...  ;D

thanks
Logged
Pages: [1]
Print