如何停止鼠标移出事件Flex的画布射击的子元素 [英] How to stop Mouse Out event on Flex Canvas firing for child elements
问题描述
我使用的是画布的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?
感谢:)
推荐答案
您应该使用<一个href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/InteractiveObject.html#event:rollOver"><$c$c>MouseEvent.ROLL_OVER$c$c>和<一href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/InteractiveObject.html#event:rollOut"><$c$c>MouseEvent.ROLL_OUT$c$c>事件代替。
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.
这篇关于如何停止鼠标移出事件Flex的画布射击的子元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!