如何停止鼠标移出事件Flex的画布射击的子元素鼠标、画布、移出、元素

2023-09-08 12:50:22 作者:最卑贱不过感情丶

我使用的是画布的itemRenderer的容器我用它来显示图像。请参阅下面的伪code。

I am using a Canvas itemRenderer for a container I use to display images. See pseudo code below.

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

在我的鼠标在画布上,在放大函数被调用。但是当我把鼠标移动到图像,或者其它子元素中,MOUSE_OUT事件。

When I mouse over the canvas, the enlarge function is called. However as soon as I move the mouse onto the image, or another child element, the MOUSE_OUT event is fired.

任何人都可以点我的方式的方向来禁止这种行为?

Can anyone point me in the direction of a way to disable this behaviour?

感谢:)

推荐答案

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

You should use MouseEvent.ROLL_OVER and MouseEvent.ROLL_OUT events instead.

从Flash CS4文档:

From the Flash CS4 documentation:

当鼠标进入显示对象区域或任何其子从一个对象,它是不是它的一个子领域,显示对象调度rollOver事件。这是比mouseOver事件,这是每次鼠标进入显示对象容器的任何子对象区域时都会派出不同的行为,即使鼠标已在显示对象容器的另一个子对象。

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.