一个很好的简单的开始一天!
我不能在我的静态类中使用dispatchEvent,我想知道是否有人知道如何实现类似的功能,或者是否有可能从我的静态类调用dispatchEvent?
当我的静态类中的功能完成时,我基本上想要在我的flash文件中通知我的动作脚本代码.
谢谢,
解决方法
在阅读了答案并了解了我能够实现的目标之后,我实现了以下内容(如果他们能够看到一些示例代码,那么将来可以帮助用户).
private static var dispatcher:EventDispatcher = new EventDispatcher(); public static function addEventListener(type:String,listener:Function,useCapture:Boolean = false,priority:int = 0,useWeakReference:Boolean = false):void { dispatcher.addEventListener(type,listener,useCapture,priority,useWeakReference); } public static function removeEventListener(type:String,useCapture:Boolean = false):void { dispatcher.removeEventListener(type,useCapture); } public static function dispatchEvent(event:Event):Boolean { return dispatcher.dispatchEvent(event); } public static function hasEventListener(type:String):Boolean { return dispatcher.hasEventListener(type); }