TracNav
AS3 STD / AS3 MC : StopWatch...
- Downloads
- Installation
- Release Notes
- Live Demo
- View Source
- Discussion
Project Owner...
- Cliff Hall
Utilities Used...
- StateMachine
Demo - Flex / StopWatch
This demo illustrates the use of the StateMachine Utility to define and navigate the states of a Finite State Machine or FSM of a working StopWatch.
Features in 1.0
- The following is a Harel StateChart describing the FSM of a classic stopwatch:
- The demo implements this the above FSM as a working stopwatch, as defined elsewhere and widely referred to as a familiar way to explain state machines in general.
- If you're confused what 'split/unsplit' mean, it is when you have the timer running, and you split the display to show a frozen lap time as of the moment you hit split, along with a continuing counter. This lets a coach easily note the lap times of individual runners in a race, for instance.
- It makes use of the FSMInjector which accepts an XML representation of the FSM for a stopwatch, registers the resultant StateMachine with the Facade.
- Check out the InjectFSMCommand for to see how easy it is to define the FSM and have it injected into your app.
- The question will certainly arise:
- Why wasn't SCXML chosen to define the FSM?
- Several reasons:
- Much more complex than we wanted to attempt.
- Conditional logic is ugly because you have to escape ampersands in xml.
- We wanted entering and exiting notifications for each state.
- The word 'event' would inevitably cause confusion to the Flash community, so we chose 'action'.
Attachments
-
stopwatch_fsm.jpg
(13.6 KB) - added by puremvc
21 months ago.
Harel State Chart for the StopWatch originally at from http://en.wikipedia.org/wiki/SCXML
