Hi flexies,
Does anyone know of a good State Machine implementation in actionscript?
One with history, concurrent states, joins, splits ( forks ), etc?
I have used Kaye's ( www.flashsim.com ), ported part of Miro Samek's
method based machine, modified a compiler (CHSM), and finally went
half the way to creating my own SCXML interpreter.
So... why ask now???
well, because after all this work it has become evident that there is
so much space for different designs that hearing other people's
practical experiences is, well, a very practical way to take some
decisions... like the following for instance:
- The state machine declaration ( states and transitions ) can be
supplied in several different ways
-- external XML declarations ( could be SCXML for example. Note that
this approach introduces some complexity due to the async loading
"state" )
-- inline XML declarations.
-- MXML declaration ( unfortunately we cannot provide an id for a
nested faceless component in flex 1.5)
-- Actionscript declaration ( instantiating classes )
-- with a class hierarchy ( a la samek )
- How do we scope state and transition ids? Per state machine? per
superstate? do we use paths?
- There is also the debate on giving each state it's own controller (
using class inheritance to override the superstate's controller ) or
using one central controller querying the machine.
- How to declare event handlers ( in the same state/transition
declaration or later on by hooking them with listeners )
- how do we implement guard conditions... are they necessary /
benefitial at all? why not just provide hooks for complex logic then.
- and Finally, how do we feed events to the machine... should we be
able to call transitions directly?
- MXML wrappers can be created to allow the use of binding and inline
event declarations
<fsm:StateProxy id="openState" stateMachine="{sm1}" stateName="open"
enter="trace('entering!'+event.target.name)" exit=""/>
<mx:Button label="close" enabled="{openState.active}"/>
Should we allow this without limits?
Pfff. write one line of code on this domain and you will see what I
mean. State machines are so broad and powerful that it is hard to see
the best way to fit them into flex at a glimpse.
Help / observations / links / ideas appreciated.
Man, we could even create a complete osflash project devoted to state machines.
( perhaps I will if there is enough interest. let me know )
Best,
Aldo
--
::::: Aldo Bucchi :::::
mobile (56) 8 429 8300
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/