I was making an application with AIR + Flex.
One Feature is like:
- When Alt key is down, the mouse cursor changes to B,
- When Alt key is up, the mouse cursor restores to A.
But the problem is that everytime a release Alt key, the mouse cursor will change back to system default (Arrow shape), and seems like the focus is on somewhere outside the stage.
That reminds me that, when Alt was pressed in a ordinary window, the menu-bar will be focused.
How can I stop this default behavior ?
p.s. I have tried the following ways and doesn`t work:
- 1) listen to stage's
KEY_DOWN
/KEY_UP
event, and addevent.stopImmediatePropagation()
in the event handlers - 2) listen to stage's
KEY_DOWN
/KEY_UP
event, and addevent.preventDefault()
in the event handlers - 3) listen to stage's
KEY_DOWN
/KEY_UP
event, and addthis.setFocus()
in the event handlers. AndcallLater(this.setFocus)
doesn't work too.
fscommand("trapallkeys", "true");
to stop the ESC key in browser in fullscreen but it doesn't work for ALT – Divorcee