Actually come to think of it would probably could have one command responded to different remote calls by using AsyncToken properly. there is an example in the docs. However that would make one big mother command, which I personally dont like. So you can start with that and refactor as need be into multiple commands later. Dimitrios Gianninas RIA Developer Optimal Payments Inc.
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jamie O Sent: Friday, January 05, 2007 10:15 AM To: [email protected] Subject: [flexcoders] Re: Cairngorm / MVC Best Practice > 3) Why exactly are u looking to do? -Have one event type 'task' that handles multiple usages -Event usages: -Display all (update arrayCollection) -Display one in detail (update instance of a VO) -Add task (add instance of VO to the arrayCollection) -Edit task (update database for instance of VO) -Delete task (remove instance of VO from db and arrayCollection) -Try to understand if one command can be written well to handle these situations, or if it is better to have a command for each scenario which all tie in to the same event type Below is some of the pieces of code I have for the 'generic command' approach that might help for discussion. //TaskEvent.as package com.events { import com.adobe.cairngorm.control.CairngormEvent; import com.vo.PersonVO; import com.vo.TaskVO; public class TaskEvent extends CairngormEvent { public static var TASK_ADD:String = "TaskAdd"; public static var TASK_EDIT:String = "TaskEdit"; public static var TASK_DELETE:String = "TaskDelete"; public var User:PersonVO; public var Task_Update:TaskVO; public function TaskEvent(p_type:String, p_User:PersonVO, p_Update:TaskVO) { super(p_type, false, true); User = p_User; Task_Update = p_Update; } } } package com.commands { import com.adobe.cairngorm.commands.Command; import com.adobe.cairngorm.business.Responder; import com.adobe.cairngorm.control.CairngormEvent; import com.model.ModelLocator; import com.business.TaskDelegate; import com.events.TaskEvent; import com.vo.PersonVO; import com.vo.TaskVO; import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; import mx.utils.ArrayUtil; import mx.collections.ArrayCollection; public class TaskCommand implements Command, Responder { public function execute(p_event:CairngormEvent):void { switch(p_event.type) { case TaskEvent.TASK_ADD: TaskAdd(TaskEvent(p_event).User, TaskEvent(p_event).Details); break; case TaskEvent.TASK_DELETE: TaskDelete(TaskEvent(p_event).User, TaskEvent(p_event).Details); break; } } //Skipped the actual content of TaskAdd / TaskDelete functions } Tom's reply leads me to believe there is a way to do the equivelent - from my coding example - of having a TaskAdd_onResult, TaskDelete_onResult and TaskAdd_onFault, TaskDelete_onFault within the same command rather than having to separate out. But how is not quite clear to me. -- WARNING ------- This electronic message and its attachments may contain confidential, proprietary or legally privileged information, which is solely for the use of the intended recipient. No privilege or other rights are waived by any unintended transmission or unauthorized retransmission of this message. If you are not the intended recipient of this message, or if you have received it in error, you should immediately stop reading this message and delete it and all attachments from your system. The reading, distribution, copying or other use of this message or its attachments by unintended recipients is unauthorized and may be unlawful. If you have received this e-mail in error, please notify the sender. AVIS IMPORTANT -------------- Ce message électronique et ses pièces jointes peuvent contenir des renseignements confidentiels, exclusifs ou légalement privilégiés destinés au seul usage du destinataire visé. L'expéditeur original ne renonce à aucun privilège ou à aucun autre droit si le présent message a été transmis involontairement ou s'il est retransmis sans son autorisation. Si vous n'êtes pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses pièces jointes, de votre système. La lecture, la distribution, la copie ou tout autre usage du présent message ou de ses pièces jointes par des personnes autres que le destinataire visé ne sont pas autorisés et pourraient être illégaux. Si vous avez reçu ce courrier électronique par erreur, veuillez en aviser l'expéditeur.

