<!-- --> <!-- /* 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 是不一样的。