读书人

flex4事件一

发布时间: 2012-09-02 21:00:34 作者: rapoo

flex4事件1

1.创建事件类

package xx.cloudstudio.xx.events{import flash.events.Event;public class StorageEvent extends Event{public var storageRequest:StorageRequest;public static const EVENETNAME:String = "storageEvent";public function StorageEvent(type:String, bubbles:Boolean,storageRequest:StorageRequest){super(type, bubbles);this.storageRequest = storageRequest;}}}

?2.自定义组件分发事件

??? ??? ??? ??? var? storageEvent:StorageEvent = new StorageEvent(StorageEvent.EVENETNAME,true,storageRequest);
??? ??? ??? ???
??? ??? ??? ???
??? ??? ??? ??? this.dispatchEvent(storageEvent);

?

3.事件是由this分发,添加this的事件监听

storageWindow.addEventListener(StorageEvent.EVENETNAME,addStorageHandler);

读书人网 >flex

热点推荐