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