I am trying to use Javascript to intercept keyboard events, so I can do CMD-W for "close-window" and whatnot, inside a Flash application, so the Browser doesn't get to use them.
Well, I am able to listen for ALT, CTRL, and CMD onKeyDown/onKeyPress events, but I am not able to listen to anything else... Here is the code, in the index.html file from a Flex Project:
<script language="JavaScript" type="text/javascript">
document.onkeydown = function(event) {applicationKeyboardHandler(event)}
document.onkeypress = function(event) {applicationKeyboardHandler(event)}
function applicationKeyboardHandler(event) {
alert("Key Pressed")
}
</script>
I would like to make it so it could listen to any key press, not just alt/ctrl/cmd. What am I missing?