I think the key here will be to make the event bubble.  This way, you can
put the listener on any component in the hierarchy above the dispatcher and
it will call the handler.

 

I don't think it is wrong to say that a listener "listens to the component".
I haven't been deep enough into the framework event code to be specific, but
conceptually, that is a valid way to look at what happens.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: [email protected] [mailto:[email protected]] On
Behalf Of quantum_ohm
Sent: Monday, October 12, 2009 11:56 AM
To: [email protected]
Subject: [SPAM] [flexcoders] Re: how to call a function from a component to
another

 

  

ok, thx for your help.

--- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
Clint Tredway <grum...@...> wrote:
>
> no... it doesn't listen to the component.. it listens for an event. X
> broadcasts the event that Y is listening for..
> 
> On Mon, Oct 12, 2009 at 10:32 AM, quantum_ohm <charly.anto...@...>wrote:
> 
> >
> >
> > I've tried this... doesn't work since the addEventListener has to listen
to
> > X.mxml so X.addEventListener
> > :-(
> >
> >
> > --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com
<flexcoders%40yahoogroups.com>, Clint
> > Tredway <grumpee@> wrote:
> > >
> > > inside an init function or similar just add something like this:
> > > this.addEventListener(EVENT,function)
> > >
> > > then in your X component just dispatch a custom event that the Y
> > component
> > > is listening for
> > >
> > > "When you choose hope, anything is possible."
> > > -Christopher Reeve
> > >
> >
> > 
> >
> 
> 
> 
> -- 
> "When you choose hope, anything is possible."
> -Christopher Reeve
>



Reply via email to