pretty tired so i hope this makes sense,
i'm trying to make a character crouch using the "c" key. i'm doing so by using a listener. the code is as follows..
keytracker = new Object();
keytracker.onKeyDown = function() {
if (Key.getCode() == 67 && crouched == false) {
crouched = true;
} else if (Key.getCode() == 67 && crouched == true) {
crouched = false;
}
}
Key.addListener(keytracker);
that doesn't do anything though. strange thing is, if i change the ascii code to 51 for the "3" key, it works fine. even stranger is that if i try using the same ascii code, 67, in an enterFrame key checking statement like this:
onEnterFrame = function() {
if (Key.isDown(67)) {
//actions
it works fine too. and strangest, just to test things i used the getascii method to trace ascii values upon keystrokes, and a bunch of keys don't return any value.
going with key.isDown is not an option for me, the listener works better for checking when a key is toggled. anyone know what's up?