And even that is not necessary, but I'm not sure exactly what is.  I'm
dispatching events from a class that only implements IMXMLObject.  I
recall reading that if you have a [Bindable] metedata tag on the class,
that Flex automatically generates the EventDispatcher code.

 

Its in the docs somewhere.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Sergey Kovalyov
Sent: Tuesday, January 09, 2007 2:28 PM
To: [email protected]
Subject: Re: [flexcoders] Dispatching an Event from a Class

 

Just call dispatchEvent() (e. g. dispatchEvent(new Event(Event.CHANGE)))
in any class that implements IEventDispatcher (e. g. all the
EventDispatcher successors). Note, that UIComponent and all its
successors implement IEventDispatcher, so dispatchEvent() could be
called in any subclass of Box, ComboBox, Label, TextArea, HSlider, etc: 

 

package {

 import mx.controls.HSlider;

 public class MyHSlider extends HSlider {

  public function MyHSlider() {
   super();
   
   dispatchEvent(new Event("instanceConstructed"));
  }
  
 }

}

On 1/9/07, Mike Anderson <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
wrote: 

Hello All,

I am attempting to dispatch an Event from a generic Class File, and I
guess I'm not doing it correctly.

I was hoping, that I could simply do this:

import mx.events.IEventDispatcher 

And then in my function, I could simply dispatch the event like this:

IEventDispatcher.dispatchEvent( event );

But it doesn't allow me to do this. In the meantime, I extended my
Class to use the UIComponent, which automatically pulls in all the 
EventDispatcher stuff. Of course, it's silly for me to do this, since I
really don't have a need to extend the UIComponent class.

There must be a way, to import the proper Class, in order to simply
dispatch events.

Any advice?

Thanks in advance for your help,

Mike

 

 

Reply via email to