Regarding the issue with StateMachine and the respondTo syntax. This is easily solved using a new feature that I implemented a few days ago, Interceptors. Interceptors are like filters for PureMVC notifications. You can drop notification, alter them enroute, etc before they reach the PureMVC actors, Mediators and Commands. The idea is adapted from the Parsley application event interceptors feature[1]. Interceptors are very similar to commands and you can do everything PureMVC commands can do.
To implement Interceptors you need to extend the AbstractInterceptor class and implement the intercept method. The interceptor object is registered like commands with the registerInterceptor in commands or fabFacade.registerInterceptor method. Inside the intercept method you can,
- Alter the body/type of the notification
- Drop the notification
- Proceed with a different notification in its place
- Send N notifications before/after the notification
The StateMachine looks pretty useful. Good work Neil and Cliff. I have put up a demo of using the StateMachine with Fabrication[2]. The key class in the demo is the StateMachineInterceptor[3]. I have registered this interceptor with the StateMachine notification names. The intercept method checks for the presence of the StateMachine slash syntax, extracts the last part from the name and converts it to the form state<Changed|Action|Cancel>.
I checked the StateMachine source. It is listening to 2 of these notifications. So instead of altering the notification I am sending the modified notification for use with the respondTo syntax.
To clarify regarding the slash syntax, Fabrication uses the slash as a separator for routing notification across modules. The notification name is not altered at any point before, during or after transport. The slash in the to argument indicates the destination address of the target module of the notification not the notification name.
With Fabrication I have tried to keep things as compatible to PureMVC(Multicore) as possible. But If you have some specific feature/utility that does not work as expected, I will try to fix anything from Fabrication's pov as long as it makes sense. ;-)
Note, Interceptors are only present on SVN at the moment. I will be adding a release swc soon.
peace,
darshan
[1] : http://www.spicefactory.org/parsley/docs/current/manual/mvc.php#config_interceptors
[2] : http://code.google.com/p/fabrication/source/browse/#svn/examples/simple_fsm/src
[3] : http://code.google.com/p/fabrication/source/browse/examples/simple_fsm/src/interceptor/StateMachineInterceptor.as