如何在Flex Canvas触发子元素时停止Mouse Out事件 [英] How to stop Mouse Out event on Flex Canvas firing for child elements

查看:128
本文介绍了如何在Flex Canvas触发子元素时停止Mouse Out事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Canvas itemRenderer作为显示图片的容器。请参阅下面的伪代码。

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)); 

当我将鼠标悬停在画布上时,会调用enlarge函数。然而,一旦我将鼠标移动到图像或另一个子元素,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?

感谢:)

推荐答案

a href =http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/InteractiveObject.html#event:rollOver =nofollow noreferrer> MouseEvent.ROLL_OVER MouseEvent.ROLL_OUT 事件。

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

p>

From the Flash CS4 documentation:


当鼠标从不是其子项之一的对象进入显示对象的区域或其任何子项的区域时,显示对象调度rollOver事件。这是与mouseOver事件不同的行为,每当鼠标进入显示对象容器的任何子对象的区域时,即使鼠标已经超过显示对象容器的另一子对象,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.

这篇关于如何在Flex Canvas触发子元素时停止Mouse Out事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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