package { import flash.events.Event; public class StartEvent extends Event { public static const START:String = "start"; public static const STWER:String = "STWER"; /** * 返回道具动态 */ public static const FHTQS:String = "FHTQS"; public static const DRAGEVENT:String = "dragEvent"; public var id:int; public var zk:Number; public var num:int; public function StartEvent(val:String):void { super(val); } } }
分发 第一种 this.mCurrentOjbect.dispatchEvent(new Event("dragEvent")); 第二种 var startEvent:StartEvent = new StartEvent("dragEvent"); this.mCurrentOjbect.dispatchEvent(startEvent);
1 注册事件 2 3 切记继承event。新手容易写错MouseEvent 4 5 choose_arr[i].addEventListener("dragEvent", onDragFinish); 6 private function onDragFinish(e):void 7 { 8 //code 9 }
时间: 2024-10-11 13:27:15