Actionscript 3 key events

Hi, I’ve just started with actionscript 3 in flash 9 alpha. Its great and a lot of it seems to be an improvement… except key events!

Now normally I would do something like


if(Key.isDown(39)) _x++;

to move something to the right, but in as3 The only way i’ve discovered to do it so far is to go


addEventListener(KeyboardEvent.KEY_DOWN, keyDown)

then add a function which acts on keydown, using KeyCode or CharCode to tell which key has been pressed.

The problem with this is that it acts more like onKeyPress rather than
onEnterFrame{ if(keyisDown) } in actionscript 2, ie its not a constantt thing, so the movement is jumpy. Is there any efficient way to do what i would have done in actionscript 2 in the past?

Thanks for any help!!

Sam :slight_smile: