麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 開發 > Flex > 正文

Flex 事件分發(FlexViewer事件機制)剝離過程

2024-09-08 18:16:55
字體:
來源:轉載
供稿:網友

將FlexViewer里面的事件分發及監聽事件機制剝離出來在其他項目中使用

AppEvent.as

package com { import flash.events.Event;/** * @author SamSung * 創建時間:2014-7-24 下午1:21:05 * */ public class AppEvent extends Event { //-------------------------------------------------------------------------- // // Properties // //--------------------------------------------------------------------------private var _data:Object;private var _callback:Function;public function AppEvent(type:String, data:Object = null, callback:Function = null) { super(type); _data = data; _callback = callback; }/** * The data will be passed via the event. It allows the event dispatcher to publish * data to event listener(s). */ public function get data():Object { return _data; }/** * @private */ public function set data(value:Object):void { _data = value; }/** * The callback function associated with this event. */ public function get callback():Function { return _callback; }/** * @private */ public function set callback(value:Function):void { _callback = value; }/** * Override clone */ public override function clone():Event { return new AppEvent(this.type, this.data, this.callback); }/** * Dispatch this event. */ public function dispatch():Boolean { return EventBus.instance.dispatchEvent(this); }/** * Dispatch an AppEvent for specified type and with optional data and callback reference. */ public static function dispatch(type:String, data:Object = null, callback:Function = null):Boolean { return EventBus.instance.dispatchEvent(new AppEvent(type, data, callback)); }public static function addListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void { EventBus.instance.addEventListener(type, listener, useCapture, priority, useWeakReference); }public static function removeListener(type:String, listener:Function, useCapture:Boolean = false):void { EventBus.instance.removeEventListener(type, listener, useCapture); }} }

EventBus.as

package com { import flash.events.Event; import flash.events.EventDispatcher;/** * The EventBus allows centrallized communication among modules without * point-to-point messaging. It uses the singleton design pattern * to make sure one event bus is available globally. The bus itself * is only available to the container. Modules use the container's * static method to communicate with the event bus. */ public class EventBus extends EventDispatcher { /** Application event bus instance */ public static const instance:EventBus = new EventBus();/** * Normally the EventBus is not instantiated via the <b>new</b> method directly. * The constructor helps enforce only one EvenBus availiable for the application * (singeton) so that it asures the communication only via a sigle event bus. */ public function EventBus() { }/** * The factory method is used to create a instance of the EventBus. It returns * the only instanace of EventBus and makes sure no another instance is created. */ [Deprecated(replacement="instance")] public static function getInstance():EventBus { return instance; }/** * Basic dispatch function, dispatches simple named events. In the case * that the event is only significant by the event token (type string), * this new dispatch method simplify the code. */ [Deprecated(replacement="AppEvent.dispatch")] public function dispatch(type:String):Boolean { return dispatchEvent(new Event(type)); } } }

(編輯:武林網)

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 毛片在线免费播放 | 午夜激情视频免费 | 欧美成人精品一区二区三区 | 久久国产精品二国产精品中国洋人 | 久久综合九色综合久久久精品综合 | 欧美性激情视频 | 亚洲第一色片 | 国产精品免费麻豆入口 | 一区二区三高清 | 国产精品久久久久久久四虎电影 | 成人小视频免费在线观看 | 综合在线视频 | 国产精品视频自拍 | 99re66热这里只有精品8 | 8x成人在线电影 | 圆产精品久久久久久久久久久 | 一级大黄毛片免费观看 | 九一成人 | 一级做人爱c黑人影片 | 欧洲精品视频在线观看 | 成年免费视频黄网站在线观看 | 中文字幕观看 | 精品一区二区三区在线观看国产 | 福利一区二区三区视频在线观看 | 免费国产视频在线观看 | 麻豆视频国产在线观看 | a视频网站 | 4p一女两男做爰在线观看 | 色诱亚洲精品久久久久久 | 特级毛片全部免费播放器 | 久久蜜桃香蕉精品一区二区三区 | 密室逃脱第一季免费观看完整在线 | 最新精品在线 | 免费a级毛片大学生免费观看 | 亚洲第一成人久久网站 | 日本中文字幕电影在线观看 | 嫩呦国产一区二区三区av | 国产剧情在线观看一区二区 | 成人做爰高潮片免费视频美国 | 日韩毛片一区二区三区 | 成人一级在线 |