Can I test keystrokes without using KeyboardEvent?
I have an ENTER_FRAME event setting called enterFrameHandler, and I want to check inside the enterFrameHandler function if any keys are pressed.
usually when using KeyboardEvent I can easily check keys using a switch that checks KeyCode events, but in the ENTER_FRAME event this is not possible for me.
Is there any other way to check the status of the keyboard in the ENTER_FRAME event?
UPDATE: I found this AS2 script:
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= power;
}
if (Key.isDown(Key.RIGHT)) {
_x += power;
}
if (Key.isDown(Key.UP)) {
_y -=power;
}
if (Key.isDown(Key.DOWN)) {
_y +=power;
}
}
This is similar to what I want, but in AS2, does anyone know how to “translate” this into AS3?