# Smooth Keyboard Press

**URL:** <https://forum.kirupa.com/t/smooth-keyboard-press/291010>\
**Category:** flash\
**Created:** [June 23, 2009, 6:38pm UTC](https://forum.kirupa.com/t/smooth-keyboard-press/291010 "2009-06-23T18:38:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick23](https://avatars.discourse-cdn.com/v4/letter/n/76d3ee/32.png) [@Nick23](https://forum.kirupa.com/u/Nick23)\
**Post date:** [June 23, 2009, 6:38pm UTC](https://forum.kirupa.com/t/smooth-keyboard-press/291010/1 "2009-06-23T18:38:58Z")

</div>

I have this code to move my player…

```auto
stage.addEventListener(KeyboardEvent.KEY_DOWN,keyboardPress);
function keyboardPress (key:KeyboardEvent):void{
    if (key.keyCode == Keyboard.LEFT){
        player.x -= 4;
    }
}

```

…however, when the left key is pressed, the player jumps left once, pauses, then continues to move left.

In AS2,

```auto
if (Key.isDown(Key.LEFT)){player.x -= 4;}

```

provided for a much smoother movement.

So, what is the code equivalent in AS3 of the code from AS2 above? Or, in other words, how do I write a smooth keyboard movement code for AS3?

Thanks
