当画布在 Flex 3 中可见时,不允许单击画布下方的组件

发布于 2024-11-07 12:32:45 字数 282 浏览 1 评论 0原文

我有一个组件(画布),上面有一个单击事件侦听器。但是,有时会在该组件上覆盖不透明的画布。当覆盖画布可见时,我不希望底层组件可单击。

有没有一种方法可以做到这一点,而无需在覆盖画布变得可见时手动删除单击事件侦听器,并在覆盖画布变得不可见时重新添加单击事件侦听器?

顺便说一句,有趣的是,覆盖画布包含标签元素,当覆盖画布可见时,底层组件只能在覆盖画布上没有标签元素的区域中单击。

另外,由于这是 Flex,我应该注意单击事件侦听器最初是通过 Actionscript 添加的,而不是通过 mxml 添加的。

I have a component (a canvas) that has a click event listener on it. However, there is sometimes an opaque canvas that lays over that component. When that overlaying canvas is visible, I don't want the underlying component to be clickable.

Is there a way to do this without manually removing the click event listener when the overlaying canvas becomes visible and adding back the click event listener when the overlaying canvas becomes invisible?

As a side note, interestingly enough, the overlaying canvas contains label elements and when the overlaying canvas is visible, the underlaying component is only clickable for the area of the overlaying canvas where there is not a label element.

Also, since this is Flex, I should note that the click event listener was originally added through Actionscript and not through mxml.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

§对你不离不弃 2024-11-14 12:32:45

我相信你想要做的是在不透明画布上设置 mouseEnabled="true"useHandCursor="false" 。这应该会阻止任何鼠标事件“穿过”画布。

I believe what you want to do is set mouseEnabled="true" and useHandCursor="false" on the opaque canvas. That should stop any mouse events to go 'through' the canvas.

池予 2024-11-14 12:32:45

我很确定您是否设置了 mouseEnabledmouseFocusEnabled 属性设置为 false,则画布将不会触发单击事件处理程序。

当然,我不认为画布(或任何容器)可以点击;所以要触发事件;画布内部必须有一些东西可以真正触发点击事件。我不确定 mouseEnabled 和 mouseFocusEnabled 属性是否会渗透到容器的子级。

I'm pretty sure if you set the mouseEnabled and mouseFocusEnabled properties to false, then the canvas will not fire the click event handler.

Of course, I didn't think canvases (or any Container) could be Clickable; so for the event to fire; there has to be something inside the canvas that actually fires the click event. I'm not sure if the mouseEnabled and mouseFocusEnabled properties trickle down to the container's children.

川水往事 2024-11-14 12:32:45

只需遮盖不透明画布,这样点击效果就不会覆盖在画布上

Just mask the opaque canvas so it wont be over the canvas with the click effect

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文