我的目标是从用户界面中删除所有悬停反馈。其动机是测试触摸界面原型,并且不希望用户在鼠标悬停时进行交互队列,而触摸界面则不会有这种情况。
我有一个部分解决方案,但它有两个问题:
- 每个组件上都需要一个事件处理程序。
-
悬停时闪烁。
受保护函数 ui_suppressHover(event:MouseEvent):void
{
var b = event.currentTarget 作为 UIComponent;
b.skin.currentState = "向上";
}
My goal is to remove all hover feedback from the UI. The motivation is for testing touch interface prototypes and not wanting users to have the queue of interactivity when the mouse hovers which they won't have with a touch interface.
I have a partial solution but it has two problems:
- Requires an event handler on each component.
-
Flickers on hover.
protected function ui_suppressHover(event:MouseEvent):void
{
var b = event.currentTarget as UIComponent;
b.skin.currentState = "up";
}
<s:Button x="118" y="60" label="Change em" click="button1_clickHandler(event)" rollOver="button1_rollOverHandler(event)" mouseOver="ui_suppressHover(event)"/>
发布评论
评论(2)
这是由马克西姆的回答激发的部分解决方案。您可以通过扩展 Button 并重写来创建一个 HoverlessButton 类:
您必须首先调用 super impl,因为它是唯一可以正确检查 isDown() 的类,而 isDown() 是私有的。
Here's a partial solution spurred by Maxim's answer. You can make a HoverlessButton class by extending Button and overriding as so:
You have to call the super impl first because it's the only one that can check properly for isDown(), which is private.
最好重写
getCurrentSkinState
,例如参见sparkButton.as
:所以只需删除
hovered || mouseCaptured“如果”。
It's better to override
getCurrentSkinState
, e.g. see sparkButton.as
:So just remove
hovered || mouseCaptured
"if".