I have my own 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 listens for this event. This class extends SpriteVisualElement.
public class SpectrumVisualizer extends `SpriteVisualElement`:
{
public function SpectrumVisualizer()
{
this.addEventListener(FFTDrawEvent.DRAW_EVENT, draw);
}
Unfortunately this will not work. An event is dispatched (returned with true), but the event listener never fires.
Both classes (Dispatcher and Listener) are child classes of the MXML application. Also listening to the event in the parent MXML application does not work. Listen to the event in the dispatch class, somehow it works.
I need to feel that the EventDispatcher class is not suitable for sending events to an mxml application or respectfully AS classes that extend / are inherent from the MXML component class.
Can anybody help me?