Open itlancer opened 4 years ago
Another steps to reproduce this issue with application deactivate
event:
1) Launch application with code below.
2) Hold left mouse button down (do not release it) on a SimpleButton
at top left corner of application.
3) "Deactivate" application. With Windows device you can simply make Alt+Tab. Application lose focus. Release left mouse button.
4) "Activate" ("show") application window again. And try to roll mouse over/out SimpleButton
.
You will see the same actual result as described in the issue.
Code sample:
package {
import flash.display.SimpleButton;
import flash.display.Sprite;
public class MouseDownLoosingFocusBug extends Sprite {
public function MouseDownLoosingFocusBug() {
//Create button
var upState:Sprite = new Sprite();
upState.graphics.beginFill(0xff0000);
upState.graphics.drawRect(0, 0, 100, 100);
upState.graphics.endFill();
var overState:Sprite = new Sprite();
overState.graphics.beginFill(0x00ff00);
overState.graphics.drawRect(0, 0, 100, 100);
overState.graphics.endFill();
var button:SimpleButton = new SimpleButton(upState, overState, overState, upState);
addChild(button);
}
}
}
Issue still exists with latest AIR 33.1.1.620.
Problem Description
Up/over states of
SimpleButton
not render properly afterMouseEvent.MOUSE_DOWN
event and application focus losing. Also this issue reproducible even without application 'deactivate' with context menus.Tested with multiple AIR versions even with latests AIR 32.0.0.89, AIR 32.0.0.144 beta and AIR 33.0.2.338 with multiple Windows and macOS devices with different OS versions with 32-bit and 64-bit AIR applications with captive runtime. Same problem in all cases. May be such problems also exists with Android and iOS but I cannot reproduce it.
Tracker link: https://tracker.adobe.com/#/view/AIR-3722067
DisplayObject
target of MouseEvent.MOUSE_DOWN doesn't matter in such cases. Changingstage.focus
after "losing focus" doesn't help.stage.nativeWindow.maximize()
after "losing focus" doesn't help.NativeApplication.nativeApplication.activate(stage.nativeWindow)
after "losing focus" doesn't help. Problem "fixes" after user left click on some display object after problem occurred (see steps below). It works fine if application "lose focus" afterMouseEvent.RIGHT_MOUSE_DOWN
orMouseEvent.MIDDLE_MOUSE_DOWN
orMouseEvent.CLICK
event. (you can simply replaceMouseEvent.MOUSE_DOWN
toMouseEvent.RIGHT_MOUSE_DOWN
in code below to test it) In code belowEvent.DEACTIVATE
event even doesn't fire. So technically application doesn't lose focus.Steps to Reproduce
1) Launch application with code below. 2) Make left mouse button click (technically it not a
MouseEvent.CLICK
butMouseEvent.MOUSE_DOWN
) on a button at top left corner of application. It show context menu. 3) Select context menu item (click on "Menu Item"). Context menu will be closed. 4) Move (roll) mouse over and outSimpleButton
.Application example with sources attached. mouse_down_losing_focus_bug.zip
Actual Result: Up and over states of
SimpleButton
doesn't render properly. Other buttons (if will be presented on the stage) also doesn't render up/over states properly when mouse move over/out them.Expected Result:
SimpleButton
correctly render up/over states when mouse move over/out of it.Known Workarounds
none *write your own button implementation