I'm wanting to globally capture the keyboard in my Flex app. I want to
be notified of every keyboard event that happens as long as the Flash
Player has the focus... regardless of whether the event happens when a
UIComponent has keyboard focus or not.

Here's what I'm doing:

stage.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyboard, false,
int.MAX_VALUE);
stage.addEventListener(KeyboardEvent.KEY_UP, handleKeyboard, false,
int.MAX_VALUE);
stage.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyboard, true,
int.MAX_VALUE);
stage.addEventListener(KeyboardEvent.KEY_UP, handleKeyboard, true,
int.MAX_VALUE);

Since the stage is at the top of the display list, and since I'm
listening for events in both the capture and bubble phase, and since I
have the highest possible event priority, should I see all keyboard
events?

The problem is that I'm not... I've got a situation in my app where I
start seeing only keyDown events with no matching keyUp events. It
happens after I click on a ComboBox drop-down in a popup, then the
popup is closed. At that point, I only get keyDown events until I
click on another UI component.

Any ideas what could be happening here?

In general, is there a way I can guarantee that I can direct *all*
keyboard events to a given function?

Thanks,

Troy.


Reply via email to