事件冒泡和停止传播 [英] Event Bubbling, and Stop Propagation

查看:31
本文介绍了事件冒泡和停止传播的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于任何事件,event.bubblesfalse 和设置 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.

推荐答案

设置 bubblesfalse 表示事件根本不会在显示列表中冒泡.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆