Look at adding event metadata.  If you add an event called myCustomEvent in
the metadata and dispatch it from the inner component, you are able to
handle it from the outer component like this:

 

<mx:app>

<mx:customComponent />

<mx:customComponent />

</mx:customComponent myCustomEvent="handleMyCustomEvent(event)" />

</mx:app>

 

That's the easy way to do it.  If you have multiple levels of nesting, I've
found it easiest to use  a Model Singleton that extends EventDispatcher and
dispatch the events and listen to the events through the model.  That's the
more complicated way to handle it.

 

Jake Churchill
CF Webtools
11204 Davenport, Ste. 100
Omaha, NE  68154
 <http://www.cfwebtools.com> http://www.cfwebtools.com
402-408-3733 x103

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of jdizowat
Sent: Friday, August 14, 2009 10:49 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Event Best Practices

 

  

Super Noob Question Incoming - 

So if I my application looks like the following -

<mx:app>
<mx:customComponent>
<mx:customComponent />
</mx:customComponent>
</mx:app>

That deepest custom component dispatches an event and I would like that
event to make it to the application level. Is that even normal to have
components that nested? 

Thanks for any insight,
Jason



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.392 / Virus Database: 270.13.56/2302 - Release Date: 08/14/09
06:10:00

Reply via email to