I am having issues with reading keyboard input in Unity3d’s Flash export. I am using the following code to listen for input (for the “a” key):
if (Input.GetKeyDown(KeyCode.A)) key="a";
This method works just fine for getting letters A-Z, 0-9, shift, enter, space, and backspace. However, this method doesn’t seem to detect any other keys–“KeyCode.Period”, Comma, Slash, Minus, Quote, etc. I’ve also tried using the following code to listen for keys:
if (Event.current.keyCode==KeyCode.Period) key=".";
Though this method works fine inside Unity3d, it doesn’t detect any key-presses at all in the Flash player. Is there any way to detect these other keys in the Flash player? The “Input.anyKeyDown” function returns true for all keyboard input INCLUDING period, comma, quote, and so on, so I know that the Flash player is catching the input, but I can’t figure out which KeyCodes are being used so that I can return the appropriate string for each keycode.
Additional Info: I’ve tried creating a key listener in AS3, but it seems that attaching this listener (by extending the MovieClip class) breaks things–all input is ignored and I get null values. I don’t have much experience with AS3, so there’s a good chance I could be implementing it incorrectly. If anyone has had success with an AS3 key listener, some tips would be greatly appreciated.