事件冒泡和停止传播 [英] Event Bubbling, and Stop Propagation
问题描述
对于任何事件,event.bubbles
到 false
和设置 event.stopPropagation()
或 stopImmediatePropagation 有什么区别()
同时处理事件?
What is the difference between event.bubbles
to false
for any event, and setting event.stopPropagation()
or stopImmediatePropagation()
while handling event?
我在 AS3 中使用 Flex4.
I'm using Flex4 with AS3.
推荐答案
设置 bubbles
到 false
表示事件根本不会在显示列表中冒泡.
Setting bubbles
to false
means the event does not bubble up the display list at all.
stopPropagation()
和 stopImmediatePropagation()
使当前事件监听器成为最后一个处理事件的监听器.
stopPropagation()
and stopImmediatePropagation()
make the current event listener the last to process an event.
stopPropagation()
和 stopImmediatePropagation()
的区别在于 stopImmediatePropagation()
不仅会阻止事件移动到下一个节点,但它也会阻止该节点上的任何其他侦听器捕获其事件.
The difference between stopPropagation()
and stopImmediatePropagation()
is that stopImmediatePropagation()
will not only prevent the event from moving to the next node, but it will also prevent any other listeners on that node from capturing their events.
这篇关于事件冒泡和停止传播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!