tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/3-statemachine-setup-errorRobotlegs: Discussion 2013-04-28T10:03:29Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/5039742009-10-27T14:22:39Z2009-10-27T14:22:39ZStateMachine Setup Error<div><p>I'd need to see more code, but I didn't test the FSM against a
single state. I will add that to the unit tests and see if I can
reproduce the error. I also didn't test against the entering
position, so I will do that also. Thank you for providing some
cases ;)</p>
<p>This is what I'd consider the minimal setup for the state
machine (as it is now):</p>
<pre>
<code> <pre>private var fsm:XML =
<fsm initial={STARTING}>
<!-- THE INITIAL STATE -->
<state name={STARTING}>
<transition action={STARTED}
target={CONSTRUCTING}/>
<transition action={START_FAILED}
target={FAILING}/>
</state>
<!-- DOING SOME WORK -->
<state name={CONSTRUCTING} changed={CONSTRUCT} exiting={CONSTRUCTION_EXIT}>
<transition action={CONSTRUCTED}
target={NAVIGATING}/>
<transition action={CONSTRUCTION_FAILED}
target={FAILING}/>
</state>
<!-- READY TO ACCEPT BROWSER OR USER NAVIGATION -->
<state name={NAVIGATING} changed={NAVIGATE}/>
<!-- REPORT FAILURE FROM ANY STATE -->
<state name={FAILING} changed={FAIL}/>
</fsm>;</pre></code>
</pre></div>Joel Hookstag:robotlegs.tenderapp.com,2009-10-18:Comment/5039742009-10-27T14:37:05Z2009-10-27T14:37:07ZStateMachine Setup Error<div><p>This is the project so far, i only have two states.</p></div>kyletag:robotlegs.tenderapp.com,2009-10-18:Comment/5039742009-10-27T15:38:44Z2009-10-27T15:38:44ZStateMachine Setup Error<div><p>LoadupMonitorEvent is missing from the archive, and there is an
error<br>
in LoginView.as at line 50 calling a class, loginMC().</p>
<p>I think also that using event constants for the state constants
is<br>
probably a bad idea, as the state machine is utilizing the
central<br>
event bus. This could very well introduce conflicts. Better to
just<br>
have a static StateMachineConstants class that defines these
states:</p>
<p><a href=
"http://github.com/joelhooks/robotlegs-examples-UnionPlatformChatClient/blob/master/src/org/robotlegs/examples/bootstrap/AppConfigStateConstants.as">
http://github.com/joelhooks/robotlegs-examples-UnionPlatformChatCli...</a></p>
<p>here is an example of that.</p></div>Joel Hookstag:robotlegs.tenderapp.com,2009-10-18:Comment/5039742009-10-27T16:34:57Z2009-10-27T16:34:57ZStateMachine Setup Error<div><p>Hey Kyle,</p>
<p>I gutted out some stuff just to show the FSM in your app as it
cycles through some states. I've attached the src folder.</p></div>Joel Hookstag:robotlegs.tenderapp.com,2009-10-18:Comment/5039742009-10-28T06:56:54Z2009-10-28T06:56:55ZStateMachine Setup Error<div><p>Hi Joel,</p>
<p>Thanks for the feedback and help.<br>
I like the StateMachineConstants idea and will now implement
it!</p>
<p>In your refleshing you code:</p>
<pre>
<code> var stateMachine:StateMachine = new StateMachine(eventDispatcher);</code>
</pre>
<p>But in the versions of statemachine i have, from git, the
statemachine doesnt take a constructor parameter. Presumable i have
the wrong version?</p>
<p>Cheers<br>
Kyle</p></div>kyletag:robotlegs.tenderapp.com,2009-10-18:Comment/5039742009-10-29T06:47:58Z2009-10-29T06:47:58ZStateMachine Setup Error<div><p>I emailed a reply, I guess it didn't go through, but yes, that
was an older version.</p></div>Joel Hooks