Only the second class -- the one that dispatches the event by calling
dispatchEvent() -- needs to extend EventDispatcher. You don't need to be
an EventDispatcher to listen to events.
 
The dispatching class must declare [Event] metadata if you want to write
listeners in MXML.
 
If your first class -- the one that listens -- is written in AS, you
register for the event by calling addEventListener():
 
    instanceOfDispatchingClass.addEventListener("someEventType",
myEventHandler);
 
You would normally do this immediately after creating
instanceOfDispatchingClass.
 
- Gordon

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Paul DeCoursey
Sent: Thursday, February 15, 2007 6:56 AM
To: [email protected]
Subject: [flexcoders] Re: eventdispatching between 2 classes



Your classes would need to extend EventDispatcher. Then they can use
the dispatchEvent function to dispatch events. To receive events you
either need to put event listeners directly on the class or on the
SystemManager. If you put the listener on the SystemManager then you
need to make sure the event bubbles. If you need a specific example I
can try to work one up.

pd

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "martywolf11" <[EMAIL PROTECTED]> wrote:
>
> hello,
> 
> i have 2 classes which i want to interact with eachother by events.
> my first class creates a second class, which reads out a mysql table.
> when the results come in, it should send an event to my first class.
> 
> how do i create the eventhandling between those 2 classes, since both
> of them must refer to the same event instance?
> 
> i read the flex language reference already and did research in the
> internet but didnt find any results.
> 
> 
> thank you
> 
> 
> greetings,
> marty
>



 

Reply via email to