I am trying to send a custom event from a custom ItemRenderer
This is my custom event.
package events { import customClass.Product; import flash.events.Event; public class CopyProductEvent extends Event { public static const COPY_PRODUCT:String = "COPY_PRODUCT"; public var picked:Prodotti; public function CopyProductEvent(type:String, picked:Product) { super(type); this.picked = picked; } } }
In itemRenderer , I have a function that does this:
private function sendEvent(o:Product):void { dispatchEvent(new CopyProductEvent(CopyProductEvent.COPY_PRODUCT,o)); }
And in the main application, I have a spark List , and I tried to add an EventListener to both the application and the list itself, but they are never called ...
this.addEventListener(CopyProductEvent.COPY_PRODUCT, function(e:Product):void{ ... }); list.addEventListener(CopyProductEvent.COPY_PRODUCT, function(e:Product):void{ ... });
Why?!? Where am I doing wrong?
The event from the function was sent correctly ... I cannot intercept it.
Marcx source share