简体   繁体   English

按钮内的闪光灯按钮

[英]flash button inside a button

I have a button containing 2 child buttons. 我有一个包含2个子按钮的按钮。 I want to be able to keep the mouse over state active, when I rollover a child button. 当我将鼠标悬停在一个子按钮上时,我希望能够保持鼠标悬停状态处于活动状态。 At present it fires mouse out when i rollover a child button, I suspect this is correct, but not what I want to happen. 目前,当我将鼠标悬停在一个子按钮上时,它会触发鼠标退出,我怀疑这是正确的,但不是我想发生的事情。

Any ideas how to get around this? 任何想法如何解决这个问题?

Change from mouseOver state to normal state in the MouseEvent.ROLL_OUT handler instead of MouseEvent.MOUSE_OUT handler. MouseEvent.ROLL_OUT处理程序(而不是MouseEvent.MOUSE_OUT处理程序)中从mouseOver状态更改为正常状态。

The purpose of the rollOut event is to simplify the coding of rollover behaviors for display object containers with children. rollOut事件的目的是简化带有子项的显示对象容器的翻转行为的编码。 When the mouse leaves the area of a display object or the area of any of its children to go to an object that is not one of its children, the display object dispatches the rollOut event. 当鼠标离开显示对象的区域或其任何子对象的区域以转到其子对象之一之外的对象时,显示对象将调度rollOut事件。 This is different behavior than that of the mouseOut event, which is dispatched each time the mouse leaves the area of any child object of the display object container, even if the mouse remains over another child object of the display object container. 这与mouseOut事件的行为不同,即使鼠标停留在显示对象容器的另一个子对象上,该事件也会在每次鼠标离开显示对象容器的任何子对象的区域时调度。

You can also add the event on both and use stopImmediatePropagation() to prevent mouse out from firing; 您也可以在两个事件上都添加事件,并使用stopImmediatePropagation()来防止触发鼠标;

More about using stopImmediatePropagation and stopPropagation() here: 有关在此处使用stopImmediatePropagation和stopPropagation()的更多信息:

http://www.senocular.com/pub/kirupa/as3tips_p6.html http://www.senocular.com/pub/kirupa/as3tips_p6.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM