这是从官方的文章中感觉重要的一个个片段中截取出来的,可能有些东西不是一个页面的。也许有的是在说明Flex时说的,也许是在解说AS3时候说的。
自己感觉挺不错的,就收集了起来。
自己尝试过翻译一下下面的文章,但总是感觉不够“原汁原味” ,其中的单词并不难,有兴趣的可以看看吧。
About the target and currentTarget properties
Every Event object has a target and a currentTarget property that help you to keep track of where it is in the process of propagation. The target property refers to the dispatcher of the event. The currentTarget property refers to the current node that is being examined for event listeners.
MouseEvent events bubble up the parent chain, and can be handled on any ancestor. As the event bubbles, the value of the event.target property stays the same (UITextField), but the value of the event.currentTarget property is set at each level to be the ancestor that is handling the event. Eventually, the currentTarget will be Button, at which time the Button control's event listener will handle the event. For this reason, you should use the event.currentTarget property rather than the event.target property
Capturing phase
During the capturing phase, Flex changes the value of the currentTarget property on the Event object to match the current node whose listener is being called. The target property continues to refer to the dispatcher of the event.
Targeting phase
In the targeting phase, Flex invokes the event dispatcher's listeners. No other nodes on the display list are examined for event listeners. The values of the currentTarget and the targetproperties on the Event object during the targeting phase are the same.
Bubbling phase
In the bubbling phase, Flex examines an event's ancestors for event listeners. Flex starts with the dispatcher's immediate ancestor and continues up the display list to the root ancestor. This is the reverse of the capturing phase.
During the bubbling phase, Flex changes the value of the currentTarget property on the Event object to match the current node whose listener is being called. The target property continues to refer to the dispatcher of the event.
When Flex invokes an event listener, the Event object might have actually been dispatched by an object deeper in the display list. The object that originally dispatched the event is the target. The object that the event is currently bubbling through is the currentTarget. So, you should generally use the currentTarget property instead of the target property when referring to the current object in your event listeners.