gordonp
|
|
« on: August 08, 2009, 07:42:24 » |
|
Take the following state machine code example
<state name={STATE_ONE} entering={ENTER_STATE_ONE} exiting={EXIT_STATE_ONE} changed={CHANGED_STATE_TWO}> <transition action={ACTION_FOO} target={STATE_TWO}/> </state>
<state name={STATE_TWO} entering={ENTER_STATE_TWO} exiting={EXIT_STATE_TWO} changed={CHANGED_STATE_TWO}> <transition action={ACTION_BAR} target={STATE_TWO}/> </state>
How can I trace specifically which transition action caused the state transition?
In other, words how can find out if it was ACTION_FOO or ACTION_BAR that caused a transition to STATE_TWO?
Another way of putting it. Assume ENTER_STATE_TWO is mapped to the following command:
package com.app.controller { import com.app.ApplicationFacade; import org.puremvc.as3.interfaces.INotification; import org.puremvc.as3.patterns.command.SimpleCommand;
public class EnteringStateTwoCommand extends SimpleCommand { override public function execute(note:INotification):void { // Entering guard code goes here } } }
Assume somewhere in my code there are the following notifications sent:
sendNotification(StateMachine.ACTION, null, ACTION_FOO);
...
sendNotification(StateMachine.ACTION, null, ACTION_BAR);
How can I query which specific ACTION brought me to this state when I am in the EnteringStateTwoCommand command? Or anywhere else in the state machine event chain for that matter. Theoretically it could be either ACTION_FOO or ACTION_BAR in the above command.
Maybe I overlooked something but what is the syntax to get the actual value of the transition action itself during a state machine notification? Is it
note.getType() Maybe it isn't possible to get the ACTION in this command? Where and when can I find out about the transition action? I am trying to debug the logic flow in my app's state machine implementation.
|