gpt4 book ai didi

apache-flex - 如何停止为子元素触发 Flex Canvas 上的 Mouse Out 事件

转载 作者:行者123 更新时间:2023-12-03 18:21:33 25 4
gpt4 key购买 nike

我将 Canvas itemRenderer 用于我用来显示图像的容器。请参阅下面的伪代码。

image = new Image();
image.source = data.@thumb;
this.addChild(image);
this.addEventListener(MouseEvent.MOUSE_OVER, enlarge(image));
this.addEventListener(MouseEvent.MOUSE_OUT, shrink(image));

当我将鼠标悬停在 Canvas 上时,会调用放大函数。但是,只要我将鼠标移到图像或另一个子元素上,就会触发 MOUSE_OUT 事件。

谁能指出我如何禁用这种行为?

谢谢 :)

最佳答案

您应该使用 MouseEvent.ROLL_OVER MouseEvent.ROLL_OUT 事件代替。

来自 Flash CS4 文档:

When the mouse enters the area of a display object or the area of any of its children from an object that is not one of its children, the display object dispatches the rollOver event. This is different behavior than that of the mouseOver event, which is dispatched each time the mouse enters the area of any child object of the display object container, even if the mouse was already over another child object of the display object container.

关于apache-flex - 如何停止为子元素触发 Flex Canvas 上的 Mouse Out 事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/557028/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com