SimpleButton Hover state in HTML5 incorrect behavior

If a SimpleButton has a hover state, the hover state remains visible after the button is clicked. It will only disappear after the user moves the cursor off the button. This does not mimic the Flash behavior of a SimpleButton which is after the button is clicked, the upstate is automatically displayed.

I’m guessing that this behavior is true for all build targets, not just HTML5.

I think that in OpenFL the visual behavior of a SimpleButton should be the same as in Flash.

In the meantime, does anyone know how to force a Simple Button to display its upstate?

It looks like its supposed to switch:

Maybe add some traces in this class and see if you can get more of an idea what is going on internally?

If that’s the __this_onMouseUp function then it is wrong. On MOUSE_UP, __currentState should always be the upState. Like I said above, the visual behavior of a SimpleButton should be the same as in Flash.

I’ve run into problems with OpenFL’s implementation of mouse events that necessitated that often after a mouse event on an object, the user has to move the cursor off that object before any other events can be detected.

Without the lines associated with displaying the overState the visual behavior is what it should be. I suggest that they be removed in the next OpenFL update.

I just fixed two cases:

  1. Setting button.enabled = false in a MouseEvent.MOUSE_UP event. It should stay on the “over” state until rolling out
  2. Setting button.enabled = false in a MouseEvent.MOUSE_DOWN event. It should switch to the “up” state when releasing

Releasing the mouse (firing a MouseEvent.MOUSE_UP) while the button is still enabled should still show the “over” state and not switch

I don’t understand why you’re using button.enabled. This is the change I made and it works.

@:noCompletion private function __this_onMouseUp(event:MouseEvent):Void
__ignoreEvent = false;

if (enabled)  __currentState = upState;


Does it work for you if you use the latest version of SimpleButton?