After along research I found a simple way where you can simply passing parameters to event hanlder.
in order to do this you need to extend the event class and create new custom class that will handle the parameters arguments as below :
in order to do this you need to extend the event class and create new custom class that will handle the parameters arguments as below :
- create new class and name it EventType.as
package {
// Import class
import flash.events.Event;
// EventType
public class EventType extends Event {
// Properties
public var arg:*;
// Constructor
public function EventType(type:String, bubbles:Boolean = false, cancelable:Boolean = false, ... a:*) {
super(type, bubbles, cancelable);
arg = a;
}
// Override clone
override public function clone():Event{
return new EventType(type, bubbles, cancelable, arg);
};
}
}
now all you need is to dispatch new event using EventType instead of event as below :
dispatchEvent(new EventType("TestHandler",false,false,"Test :)"))
private function TestHandler(e:EventType):void
{
trace( e.arg[0]);
}
hope it save your time :)