views:

31

answers:

2

I want to handle the keydown event globally in my application and as such have added the event handler to the top most DisplayObject in the display list. However, the event doesn't seem to fire unless the cursor focus is on a Textbox or Datagrid or the like.

How can I have key presses handled globaly by the application?

A: 

stage.addEventListener(...) ?

Theo.T
You're right but I guess the question is WHEN to I create this event listener. Googling the issue recommends adding the event listener during FlexEvent.APPLICATION_COMPLETE but that event never seems to fire
Antilogic
A: 

First, you won't detect any keystroke until your flex application get the focus. You can do it automatically by calling a js script at startup that will set the focus on the application

Once done, I would recommand you to add your key listener on systemManager. Doing that will allow you to handle keydown event globally.

PeZ
Doesn't AC_FL_RunContent set focus automatically?
Antilogic