事件冒泡,并停止传播事件

2023-09-09 21:37:36 作者:浅笑〃掩不了忧伤

event.bubbles为false之间的区别对于任何事件设置event.stopPropagation()或stopImmediatePropagation()在处理事件是什么? 使用FLEX4与AS3林。

解决方案

设置气泡为false表示该事件不会冒泡了显示列表都没有。

stopPropagation和stopImmediatePropagation使当前事件侦听器的最后一个处理一个事件。

stopPropagation和stopImmediatePropagation之间的区别在于stopImmediatePropagation不仅将prevent从移动到下一个节点的情况下,但它也将prevent从捕获它们的事件在该节点上的任何其他的听众。

What is the difference between event.bubbles to false for any event, And Setting event.stopPropagation() or stopImmediatePropagation() while handling event? Im using flex4 with as3.

解决方案

Setting bubbles to false means the event does not bubble up the display list at all.

JS的事件绑定和事件流模型

stopPropagation and stopImmediatePropagation make the current event listener the last to process an event.

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.