Creates and registers a StateMachine described in XML.
This allows reconfiguration of the StateMachine without changing any code, as well as making it easier than creating all the State instances and registering them with the StateMachine at startup time.
One way to acheive this setup is to use a command controller that could be added a application startup. Such a controller could look like this:
//From the PureMVC AS3 StopWatch Demo
class InjectFSMCommand extends SimpleCommand
{
public function execute ( INotification $notification )
{
// Create the FSM definition
$fsmStr = <<<XML
<fsm initial="StopWatch/states/ready">
<state name="StopWatch/states/ready" entering="resetDisplay">
<transition action="StopWatch/actions/start" target="StopWatch/states/running"/>
</state>
<state name="StopWatch/states/running" entering="ensureTimer">
<transition action="StopWatch/actions/split" target="StopWatch/states/paused"/>
<transition action="StopWatch/actions/stop" target="StopWatch/states/stopped"/>
</state>
<state name="StopWatch/states/paused" entering="freezeDisplay">
<transition action="StopWatch/actions/unsplit" target="StopWatch/states/running"/>
<transition action="StopWatch/actions/stop" target="StopWatch/states/stopped"/>
</state>
<state name="StopWatch/states/stopped" entering="stopTimer">
<transition action="StopWatch/actions/reset" target="StopWatch/states/ready"/>
</state>
</fsm>XML;
$fsm = new SimpleXMLElement($fsmStr);
$injector = new FSMInjector($fsm);
$injector->initializeNotifier('FSMInjectorTest');
$injector->inject();
}
}