Hi,
You can use a key listener to get all pressed keys. The code below is an example. NumLock would have to be on, I think, for this method to work, otherwise you would have to use a case statement to direct the keycodes, since the output wouldn't have an ascii value.
- dialectric
PHP Code:
//--------------------------------------------------------------------
//key_listen_obj.as for use with keyboard actionscript
//--------------------------------------------------------------------
//create object
key_listen = new Object();
key_info = new Object();
//key listener
key_listen.onKeyDown = function(){
key_info.ref = Key;
key_info.keycode = Key.getCode();
key_info.ascii = Key.getAscii();
key_info.string = (String.fromCharCode(key_info.ascii));
key_info.number = Number(key_info.string);
/* use traces to test input */
//trace ("the current key is : " +key_info.keycode)
//trace ("the current key ascii is : " +key_info.ascii)
if ((key_info.keycode != 0) && (key_info.number != undefined)) {
// a valid key is pressed
run_calculator_function(key_info.number);
} else {
break;
};
};