首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

flex4事件一

2012-09-02 
flex4事件11.创建事件类package xx.cloudstudio.xx.events{import flash.events.Eventpublic class Stora

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);

热点排行