Reputation: 7681
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:
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)"/>
Upvotes: 0
Views: 1380
Reputation: 7681
Here's a partial solution spurred by Maxim's answer. You can make a HoverlessButton class by extending Button and overriding as so:
override protected function getCurrentSkinState():String
{
var state:String = super.getCurrentSkinState();
if (state == "over")
state = "up";
return state;
}
You have to call the super impl first because it's the only one that can check properly for isDown(), which is private.
Upvotes: 1
Reputation: 3022
It's better to override getCurrentSkinState
, e.g. see spark Button.as
:
override protected function getCurrentSkinState():String
{
if (!enabled)
return "disabled";
if (isDown())
return "down";
if (hovered || mouseCaptured)
return "over";
return "up";
}
So just remove hovered || mouseCaptured
"if".
Upvotes: 2