Hmm... My e-mail got cut off for some reason.

For each, of my SequenceCommands I then put the following after the execute statement:

            var sequenceEvent:SequenceEvent = SequenceEvent(cairngormEvent);
            nextEvent = sequenceEvent.nextEvent;

Then of course at the end of the execute or onResult I put:

            executeNextCommand();

To build a chain of commands, you must build the chain of events from last to first.

            var secondEvent : SequenceEvent = new SequenceEvent(Controller.EVENT_DO_SECOND);
            var firstEvent : SequenceEvent = new SequenceEvent(Controller.EVENT_DO_FIRST, secondEvent);
            CairngormEventDispatcher.getInstance().dispatchEvent(firstEvent);

There may be a better approach, but this has been working for me.


--Josh




On 7/5/06, Joshua Garnett <[EMAIL PROTECTED]> wrote:
There are a couple of ways that you can do it.  1) Have your command extend SequenceCommand and then in the command's constructor call super(nextEvent). or 2) You can dynamically assign the nextEvent by passing it to the command.  This is the way I prefer, since it allows you to build different chains of commands.  To aide this I built a class called SequenceEvent:

    public class SequenceEvent extends CairngormEvent
    {
        public var nextEvent : CairngormEvent;
       
        public function SequenceEvent ( eventType:String, nextEvent : CairngormEvent = null )
        {
            super( eventType );           
            this.nextEvent = nextEvent;
        }
    }

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





YAHOO! GROUPS LINKS




__,_._,___

Reply via email to