我试图从子类中点燃一个事件, 我有3个班级; 事件汉德勒,主要类, 亚类。
< 强势> EvenHandler.as 强>
public class EventHandler extends Event
{
public static const TEST_EVENT:String = "Test";
public function EventHandler($type:String, $params:Object, $bubbles:Boolean = false, $cancelable:Boolean = false)
{
super($type,$params, $bubbles, $cancelable);
this.params = $params;
}
public override function clone():Event
{
return new EventHandler(type, this.params, bubbles, cancelable);
}
}
< main > mainClass.as % >
public function MainClass()
{
addEventListener(EventHandler.TEST_EVENT, testFunc);
}
private function testFunc(e:EventHandler){
trace("OK");
}
<强度 > SubClass.as 强度>
private function CustomFunction(event:MouseEvent):void {
dispatchEvent(new EventHandler(EventHandler.TEST_EVENT,customObject));
}
I get VerifyError: Error #1063: flash.events::Event() What s wrong with my architect? Thanks!