I have a custom event class
public class FFTDrawEvent extends Event {
public static const DRAW_EVENT:String = "drawEvent";
private var _param:Array = new Array();
public function FFTDrawEvent(type:String, __param:Array, bubbles:Boolean=true, cancelable:Boolean=false) {
_param = __param;
super(type, bubbles, cancelable);
}
public function get param():Array {
return _param;
}
}
This event is dispatched by a class, that extends EventDispatcher
:
public class ToneGenerator extends EventDispatcher {
public function someFunction():void {
this.dispatchEvent(new FFTDrawEvent(FFTDrawEvent.DRAW_EVENT,_param));
}
Another class listen to this event. This class is extending SpriteVisualElement.
public class SpectrumVisualizer extends `SpriteVisualElement`:
{
public function SpectrumVisualizer()
{
this.addEventListener(FFTDrawEvent.DRAW_EVENT, draw);
}
Unfortunately this doesn't work. The event is dispatched (returns with true), but the Event listener is never triggered.
Both class (Dispatcher & Listener) are Child class of a MXML application. Also listen to the event in the parent MXML application doens't work. Listen to the event in the dispatching class itself somehow works.
I have to feeling that the EventDispatcher class is not the right one to dispatch events to a mxml application or respectivly AS classes, which extend/inherent from a MXML component class.
Anybody can help me with that?