Flex Event总结

<!-- --> <!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体; mso-font-kerning:1.0pt;} p.MsoCommentText, li.MsoCommentText, div.MsoCommentText {mso-style-noshow:yes; margin:0cm; margin-bottom:.0001pt; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体; mso-font-kerning:1.0pt;} span.MsoCommentReference {mso-style-noshow:yes; mso-ansi-font-size:10.5pt; mso-bidi-font-size:10.5pt;} p {mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; font-size:12.0pt; font-family:宋体; mso-bidi-font-family:宋体;} code {mso-ansi-font-size:12.0pt; mso-bidi-font-size:12.0pt; font-family:宋体; mso-ascii-font-family:宋体; mso-fareast-font-family:宋体; mso-hansi-font-family:宋体; mso-bidi-font-family:宋体;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:42.55pt; mso-footer-margin:49.6pt; mso-paper-source:0; layout-grid:15.6pt;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:1554778153; mso-list-type:hybrid; mso-list-template-ids:-473270882 -1394035092 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l0:level1 {mso-level-text:%1.; mso-level-tab-stop:18.0pt; mso-level-number-position:left; margin-left:18.0pt; text-indent:-18.0pt;} ol {margin-bottom:0cm;} ul {margin-bottom:0cm;} -->

红色:注意事项           绿色:提醒            蓝色:关键事项

1.              [S1]   是所有的事件都有三个阶段: Capture Target Bubbling

事件只有在 DisplayObject 才上有 Capturing Bubbling 阶段。

2.              Target 是派发该事件的对象。 CurrentTarget 是监听了该事件并正在处理该事件的对象。

3.              Capturing [S2]   流程: Stage à SystemManager à Application à à 派发该事件的父对象。

4.              Bubbling [S3]   流程:派发该事件的父对象 à à Application à SystemManager à Stage

5.              mxml 标签中定义的事件监听器是无法用 removeEventListener() 去掉的,并且无法设置 useCapture priority 属性。

6.              removeEventListener() 去掉未添加的事件器时是不会报错的,所有无需用 hasEventListener() 判断,但添加时需要判断,否则可能会添加多次。

7.              Priority 越大的监听器,越先执行。

8.              weakRef [S4]   对于非内嵌函数没用。

9.              一个对象可以给同一个事件 多个监听器:

假如按添加顺序是 eventListener1, eventListener2 eventListener3 eventListener1 没有调 stopPropagation() stopImmediatePropagation() 方法。假设 eventListener2 调了其中 [S5]   stopPropatation() ,则 eventListener3 还会继续执行。但如果 eventListener2 调的是 stopImmediatePropagation() ,则 eventListener3 不会继续执行。

10.         removeEventListener() 只能一次去掉一个监听器,为同一个事件添加了几个监听器就需要调几次removeEventListener() ,而且参数要相符 [S6]  

11.            hasEventListener() willTrigger() 的区别是:hasEventListener() 只检查它所属的对象,而 willTrigger [S7]   () 检查整个事件流以查找由 type 参数指定的事件。

12 keyCode [S8]   对应的是 key 键盘 上的键值,是一个数字 charCode 对应的是该 key 当前字符集 中的值,也是一个数字 。因此就有下面的情况发生 : 1 ! keyCode 是一样的,但他们的 charCode 是不一样的。


  [S1] 事件只有在 DisplayObject 才上有 Capturing Bubbling 阶段。

  [S2] 从根节点到叶节点的父对象

  [S3] 从叶节点的父对象到根节点

  [S4] 如果设为 true ,只有内嵌函数可能会被垃圾回收器处理。

  [S5] stopPropagation() stopImmediatePropagation()

  [S6] use_capture

  [S7] 包括检查所有的父对象。

  [S8] keyCode keyChar 都是 KeyBoardEvent 的属性。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值