You can reuse the same event, but forgo the constructor. Have the event  class have the following fields:
 
public var xmlData:XML;
public var itemId:Number;
 
So set which ever one u want based on the type of update u are doing, the command will extra what data it needs from the event. That should save u some code. Also, if u are sending just one piece of data, which is not so detailed, then don't create a specific event class, just create and instance of the Cairngorm class and use its generic "data" field.
 
Dimitrios Gianninas
RIA Developer
Optimal Payments Inc.
 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jason
Sent: Monday, August 14, 2006 6:10 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Cairngorm:One controller, so many commands, so many delegates, so many event

I tried combining similar events, commands, delegates with mixed success.  For instance if I had one event called "UpdateTreeDataEvent" where I assigned different events as static vars like "ADD", "ADD_CHILD", "EDIT", "DELETE", etc.  I could call specific events in that event class with

var nav:UpdateTreeDataEvent = new UpdateTreeDataEvent(UpdateTreeDataEvent.DELETE, '', customForms);   
CairngormEventDispatcher.getInstance().dispatchEvent(nav);

However I ran into problems when I wanted to send different types of data to the event.  AS3 does not allow for overloading of the constuctor. So if I wanted to send a XML for my ADD and a Number for my DELETE events then I was forced to create an Object of properties and then look through that object to see what data was in it (send multiple props and send some as null data)

In the end it kinda was more work then just creating the dozen or so different Class files. 

How are others dealing not wanting to have 400 files for 100 events?


--jason





--- In [EMAIL PROTECTED]ups.com, "Dimitrios Gianninas" <dimitrios.gianninas@...> wrote:
>
> What I do is typically is have one delegate that groups server interaction for every specific portion of the app. So one delegate is used by several commands. For an example ticketing app I'd have a UserDelegate (for specific user interaction, might have several method) and TicketDelegate (has several methods for interacting with a server... ex.: create, update, etc...)
>
> Hope that helps.
>
> Dimitrios Gianninas
> RIA Developer
> Optimal Payments Inc.
>
>
> ________________________________
>
> From: [EMAIL PROTECTED]ups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of flxcoder
> Sent: Monday, August 14, 2006 2:01 PM
> To: [EMAIL PROTECTED]ups.com
> Subject: [flexcoders] Cairngorm:One controller, so many commands, so many delegates, so many events
>
>
>
> Now I have about 4-5 events that correspond with the app server and
> get data back. Each of these events get registered with the
> CairngormEvent. When the controller executes these events it needs a
> command associated with the event. Each such command needs a delegate.
>
> So for my one interaction with the server I have at least one Event
> class, one Command class and one delegate class and untold number of
> interests in the ModelLocator. This is leading to code cluge.
>
> Just wondering whether this is what the rest of the developers are
> doing or am I doing something wrong. In my app, I might end up having
> about 30-40 separate server calls at least. That will lead to 90-120
> independant files.
>
> Is this what you are running into as well? Am I missing something?
>
> Thanks.
>
>
>
>
>
> --
> 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.
>

AVIS IMPORTANT

WARNING

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.

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.

__._,_.___

--
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