This content has been marked as final. Show 2 replies
Check out the CairngormFramework, developed by Adobe Consulting ( http://labs.adobe.com/wiki/index.php/Cairngorm), specifically the SequenceCommand class. Here's the ASDoc text for the SequenceCommand (from http://www.cairngormdocs.org/docs/cairngorm_2_1/):
The SequenceCommand is provided as a "psuedo-abstract" (since ActionScript has no real concept of abstract classes) base-class that can be extended when you wish to chain commands together for a single user-gesture, or establish some simple form of decision-based workflow.
By extending SequenceCommand, you can specify the event that should be broadcast to the controller (causing another command execution without a further user-gesture) when the current command has completed execution.
For a command implementing the Responder interface, you may choose to sequence a subsequent command on successful completion of the command, in the onResult() handler, or on failure of the command in the onFault() method.
For commands that do not implement the Responder interface, you can simply chain commands by causing the sequenced command to be invoked as the last action in your command's execute() method.
I take the easy way, and define a queryId property on AsyncToken. For complex processing I sometimes also include a "callnext" string
Then in the result handler, a switch statement reads the queryId and callNext strings and performs the next action.
This actually is easy to amintain, since all the processing logic is in one place.