[flexcoders] Talking Components

2006-07-21 Thread Michael
I have a Flex app with two custom components.   What is the best way
for these two components to talk to each other.  Pass a reference of
one component to the other, databinding, or event broadcast to each other?

I basically have one component that is a list of ID/Names, when I
double click, I want the other component to get the ID and retrieve
the extended data from the DB.   My data is not stored in the
main.mxml application.   I know in Flash you would use event
listeners, but can the event listeners in Flex also send data?  The
examples I have seen broadcast a message, but they don't seem to send
data like Flash dispatch events would. 


- Michael  






 Yahoo! Groups Sponsor ~-- 
Something is new at Yahoo! Groups.  Check out the enhanced email design.
http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/nhFolB/TM
~- 

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

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




Re: [flexcoders] Talking Components

2006-07-21 Thread Jeremy Lu




Surely it can.

You can create a MyEvent class which extends Event then add in as many
properties you want (something like data), there's a fine example in
the manual about creating custom event.

When you need to broadcast event from one component to another, just use:

comp.dispatchEvent( MyEvent(someEvent, myDataObject) );

this should do the trick.


Jeremy.
On 7/22/06, Michael [EMAIL PROTECTED] wrote:













  



I have a Flex app with two custom components.   What is the best way
for these two components to talk to each other.  Pass a reference of
one component to the other, databinding, or event broadcast to each other?

I basically have one component that is a list of ID/Names, when I
double click, I want the other component to get the ID and retrieve
the extended data from the DB.   My data is not stored in the
main.mxml application.   I know in Flash you would use event
listeners, but can the event listeners in Flex also send data?  The
examples I have seen broadcast a message, but they don't seem to send
data like Flash dispatch events would. 

- Michael  


  















__._,_.___





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



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___