Hi all,
I set up some code to record key presses and specific chords. My problem is that I only want the keys to fire once when pressed. This is especially a problem when I require the user to hold CTRL + LEFT for an action.
The user experience is that I want users to hold down CTRL to enter a mode and then press the LEFT key as many times as needed. Currently, the CTRL trace and LEFT trace fire continuously. Is there a way to do a onKeyRelease?
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.CONTROL)) {
trace("control is down");
if ((Key.isDown(Key.LEFT))) {
trace("delete a key");
}
}
if (Key.isDown(Key.LEFT)) {
trace("left is down");
}
if (Key.isDown(Key.UP)) {
trace("up is down");
}
if (Key.isDown(Key.RIGHT)) {
trace("right is down");
}
if (Key.isDown(Key.DOWN)) {
trace("down is down");
}
};
keyListener.onKeyUp = function() {
}
Key.addListener(keyListener);
thanks,
nick