We’ve been using the task based sequence for a while now and are very pleased with it. One thing we missed, was the possibility to listen to an event.
Besides the ConditionalTask (which waits for an other Task to be completed), we’ve now added the EventListenerTask. This task waits until an object has dispatched an event before continuing the sequence.
Here is a code example
//create a new sequence that will hold tasks var sequence: Sequence = new Sequence(); //wait until the user clicked on the 'myButton' instance sequence.add(new EventListenerTask( myButton, MouseEvent.MOUSE_DOWN ); //call a callback method in the present scope sequence.add(new CallbackTask(onDone)); //start the sequence sequence.execute();
With this new Task it’s very easy to (for example) pause the Sequence until the user pressed a button or pressed a key… or until some other object dispatched an event.