Capture global keyboard events on Flex 2 and Actionscript 3
Mar 21st, 2007 by Onyrix 860 Views |
Email This Post
|
Print This Post
If you want to capture global keyboard events maybe you put this line of code in the constructor method of your actionscript 3 class:
addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
or
this.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
but maybe it doesn’t work?
Simple! because you have to add the listener to the stage object giving focus to it…
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);

del.icio.us
Digg
Furl
Reddit
Technorati