Thank you Dimitrios!
 
Now it all makes sense to me - the key is using the Getters and Setters as the 
method for handling all the value assignments.  Once you do that, you have all 
the CollectionEvents at your disposal.
 
So I guess in some odd way, we are still using Event Broadcasting to accomplish 
my goals, but just not in the way that I envisioned doing it.
 
Very nice :)
 
Again, thanks for the wonderful advice -
 
Mike

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Dimitrios Gianninas
Sent: Sunday, January 14, 2007 11:29 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Need primer on Events, from the List Gurus -


Ok here is how I would do it. Say the ArrayCollection held notes as an example.
 
// in command
ModelLocator.getInstance().notes.addItem( mynewnote );
 
// view is binded
<bla:MYView notes="{ModelLocator.getInstance().notes}"/>
 
// inside the view
public function set notes( values:ArrayCollection ):void {
   mygrid.dataProvider = values;
   values.addEventListener( CollectionEvent.COLLECTION_CHANGE, 
onCollectionChange );
}
 
Now what will happen is the minute you add a new note to your model, the 
"onCollectionChange" method will be called and that will allow you to do any 
added operations you wish, hope that helps.
 
Dimitrios Gianninas
RIA Developer
Optimal Payments Inc.
 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mike 
Anderson
Sent: Friday, January 12, 2007 11:03 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Need primer on Events, from the List Gurus -



Hello Dimitrios,
 
I was trying to keep my post as generic as possible - which is why I didn't 
post specifics.
 
In this particular instance however, I want to broadcast a Custom Event to a 
DataGrid residing on a Panel Control - to Scroll to the very top, whenever I 
add a new record to an ArrayCollection (residing in the ModelLocater).  This 
can happen ONLY when I add a new record - and this is why I want to create a 
Custom Event for this.  I am pushing for a Custom Event, because I don't think 
there is a built-in Event native to the DataGrid, that I can count on 100% of 
the time, to fire off ONLY when New Records are being added.
 
The catch is, I can't dispatch the Event until I get my onResult response from 
the ColdFusion Server - indicating that the Database Insert was in fact 
successful, and that it's now okay to update the Model's ArrayCollection with 
the new ValueObject.
 
Since the onResult logic resides in a Cairngorm Command Class, this is where I 
need to dispatch the Event from.  Or at least initiate the command to dispatch 
the Event, which can reside in the ModelLocater - and dispatch it from there.
 
Since all of my primary Views containing the Model-bound Controls, have a 
reference to the ModelLocater, I am thinking that there must be a way to 
dispatch these Events from the Model - and have a way for these Views to 
respond accordingly.
 
If you could help me out in this regard, I really would be truly grateful.  My 
application development, has literally come to a screeching HALT, because of me 
not knowing how to handle all these issues.
 
I am tracking down every Event Broadcaster and Listener Tutorial I can get my 
hands on, so that I can learn more about how all this works.  But in all of the 
examples I download and dissect, they ALL have a common View, that centralizes 
the code - in which it's quite easy to tie everything together.
 
In my case, I have Views and Controls scattered all over the place - and they 
can be instantiated (or not be for that matter) at any given moment.  I just 
don't know how to write code to broadcast Events in such a manner, so that each 
component has no prior knowledge of any other component.
 
I hope I'm explaining all this properly...
 
Thanks in advance,
 
Mike

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Dimitrios Gianninas
Sent: Friday, January 12, 2007 3:01 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Need primer on Events, from the List Gurus -


what "other" thing do u want to do? give an example and we can take it from 
there.
 
Dimitrios Gianninas
RIA Developer
Optimal Payments Inc.
 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mike 
Anderson
Sent: Friday, January 12, 2007 1:53 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Need primer on Events, from the List Gurus -



Hello All,

This thread, directly relates to all the other ones I've posted recently
- as I think one of my root problems, is truly understanding on how
Events get propagated within an application.

They say the Event model is so great, due to all the components being so
loosely coupled. So either I am missing something really rudimentary
here, or the Event model doesn't work the way I thought it did.

In every example I've seen, for an Event Listener and Broadcaster setup
to work properly, there must be a common link (like a container) between
the 2 components - and then, there are the 3 key things which must be in
place: The Event Listener, the Broadcaster, and the Function that gets
run whenever the Event gets triggered.

But what about the times, where I won't know for sure beforehand, which
component I will be using at the time? Especially in a Cairngorm
Application, where the Commands (which is where I desperately need to
broadcast my Custom Events from) literally NEVER know where their Result
Events are going to be sent. Of course, this is where the true power of
Cairngorm-based Applications comes into play.

All the Commands do really, is update the ModelLocater with their
updated results - and because of Data Binding, the Components in the
Application show the updated results. For me unfortunately, there is
always much more that needs to be done, after a Result is brought back -
and I need to find a way to tell my Application Components, to perform
their next task (based on a Custom Event, that I broadcast).

Can anybody show me how to Broadcast Events in such a manner, that they
get disseminated "Application-wide"??? This way, I don't need to know
beforehand, which Components will be Receiving the Events.

This is the final thing on my plate that I must figure out, then I can
FINALLY finish my app and find some peace in my life....

Thanks in advance,

Mike



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.

 

Reply via email to