Is it possible to check for pressed keys without using the KeyboardEvent?
I have an ENTER_FRAME event setup called enterFrameHandler and I want to check within the function enterFrameHandler if any keys are pressed.
normally when using a KeyboardEvent I could check for keys easily using a switch that checks the KeyCode of the event, but in an ENTER_FRAME event this isn't possible for me.
Is there any other way of checking the keyboard's state within 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 seems to be doing what I want, but it's in AS2, does anyone know how to 'translate' this into AS3?