flex4学习笔记_events
2011-06-30 17:33
309 查看
Summary for events in flex4
(英语摘自原文,这个貌似只适合我自己看。。。)
In this chapter, I described the Flex event architecture and how you can create your own events to
share data between application components. You learned the following:
● a Flex applications are event-driven.
● Every component that dispatches events includes EventDispatcher in its inheritance hierarchy.
● You handle events with either MXML-based event handlers or the addEventListener() method.
调用event的处理函数一般有两种方式(MXML-based & AS),比如
<components:LoginForm login=”loginHandler(event)”/>
等同于
myForm.addEventListener(LoginEvent.LOGIN, loginHandler); //LoginEvent.LOGIN就是String("login")
这里的login对应于自定义组件LoginForm中的元数据声明
<fx:Metadata>
[Event(name=”login”, type=”events.LoginEvent”)]
</fx:Metadata>
类似的,Button也是一个组件,click就对应于login
<s:Button id="myButton" label="Click me" click="clickHandler(event)">
或者 myButton.addEventListener(MouseEvent.CLICK, clickHandler);
//这里clickHanlder不需要参数
● Event handler functions receive a single event argument and return void.
● Flash Builder 4 adds the capability to generate event handler functions for all Flex components and events.
这点确实好用,bible这本书上有详细的介绍
● You can declare and dispatch custom events from your custom components.
● You can create custom event classes to store and send data from custom components to the rest of the application.
在我看来,这点比较适用于数据交换、传递。在组件内监听一个事件,进行一些处理,把结果保存在event的属性上,比如event.text,在组件外可以通过handler function把这个属性传递给其他的组件属性。
● To make a custom event class bubble, set its bubbles property to true.
在我的理解,各个“容器”“从小到大”,依次响应event,比如click(如果设有handler function)
● Override the Event class’s clone() method if you want to be able to re-dispatch custom event objects from an event handler method.
这点不知道实际用途有哪些。。。
● You handle custom events and event classes with the same architecture as pre-built classes that are included in the Flex SDK.
这个就如同上面的类比
(英语摘自原文,这个貌似只适合我自己看。。。)
In this chapter, I described the Flex event architecture and how you can create your own events to
share data between application components. You learned the following:
● a Flex applications are event-driven.
● Every component that dispatches events includes EventDispatcher in its inheritance hierarchy.
● You handle events with either MXML-based event handlers or the addEventListener() method.
调用event的处理函数一般有两种方式(MXML-based & AS),比如
<components:LoginForm login=”loginHandler(event)”/>
等同于
myForm.addEventListener(LoginEvent.LOGIN, loginHandler); //LoginEvent.LOGIN就是String("login")
这里的login对应于自定义组件LoginForm中的元数据声明
<fx:Metadata>
[Event(name=”login”, type=”events.LoginEvent”)]
</fx:Metadata>
类似的,Button也是一个组件,click就对应于login
<s:Button id="myButton" label="Click me" click="clickHandler(event)">
或者 myButton.addEventListener(MouseEvent.CLICK, clickHandler);
//这里clickHanlder不需要参数
● Event handler functions receive a single event argument and return void.
● Flash Builder 4 adds the capability to generate event handler functions for all Flex components and events.
这点确实好用,bible这本书上有详细的介绍
● You can declare and dispatch custom events from your custom components.
● You can create custom event classes to store and send data from custom components to the rest of the application.
在我看来,这点比较适用于数据交换、传递。在组件内监听一个事件,进行一些处理,把结果保存在event的属性上,比如event.text,在组件外可以通过handler function把这个属性传递给其他的组件属性。
● To make a custom event class bubble, set its bubbles property to true.
在我的理解,各个“容器”“从小到大”,依次响应event,比如click(如果设有handler function)
● Override the Event class’s clone() method if you want to be able to re-dispatch custom event objects from an event handler method.
这点不知道实际用途有哪些。。。
● You handle custom events and event classes with the same architecture as pre-built classes that are included in the Flex SDK.
这个就如同上面的类比
相关文章推荐
- Java与Flex学习笔记(1)---Myeclipse9.0与eclipse 3.6 集成Flah Builder 4.5教程(2012-04-03 更新)
- Flex_大师之路学习笔记
- Flex学习笔记第一季
- Flex学习笔记:ArrayCollection和Array的区别
- Flex 学习笔记 Tree的ICON设置资料收集
- Flex学习笔记(1)
- Flex学习笔记_04 使用容器控制界面布局
- Java与Flex学习笔记(8)----Flex带进度条的多文件上传(基于Servlet)
- flex 学习笔记 正则表达式(一)
- Flex学习笔记第二篇
- Flex与As3学习笔记之:Part 1 Flex语言基础
- Adobe&nbsp;FLEX学习笔记(2)-Hello&nbsp;Wo…
- Flex 学习笔记
- Flex学习笔记3——组件和容器
- flex 入门学习笔记2 之popupbutten的使用
- flex 入门学习笔记3 之RadioButton和RadioButtonGroup
- flex学习笔记 state(一)
- FLEX学习笔记:屏蔽DataGrid中的dataTip
- Flex学习笔记15——module 模块
- Flex学习笔记(十三)——内存泄露