export class Message extends egret.Event{ data: any; constructor(type: string, data: any, bubbles: boolean = false, cancelable: boolean = false) { super(type, bubbles, cancelable); this.data = data; } } export class MessageUtils{ private static eventDispatcher: egret.EventDispatcher = new egret.EventDispatcher(); static register(type: string, call: Function, thisObject: any, priority: number = 0): void { this.eventDispatcher.addEventListener(type, call, thisObject, false, priority); } static unregister(type: string, call: Function,thisObject:any): void{ this.eventDispatcher.removeEventListener(type, call, thisObject); } static send(type: string, data: any = null): void{ this.eventDispatcher.dispatchEvent(new Message(type, data)); } }