PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: marcink on March 02, 2009, 09:01:30



Title: another statemachine question...
Post by: marcink 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


Title: Re: another statemachine question...
Post by: Neil Manuell 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?



Title: Re: another statemachine question...
Post by: marcink on March 03, 2009, 04:32:57
hi neil,

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

thanks