# Press Two key at a time

**URL:** <https://forum.kirupa.com/t/press-two-key-at-a-time/288747>\
**Category:** Uncategorized\
**Created:** [May 20, 2009, 1:12pm UTC](https://forum.kirupa.com/t/press-two-key-at-a-time/288747 "2009-05-20T13:12:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gyan\_Singh](https://avatars.discourse-cdn.com/v4/letter/g/848f3c/32.png) [@Gyan\_Singh](https://forum.kirupa.com/u/Gyan_Singh)\
**Post date:** [May 20, 2009, 1:12pm UTC](https://forum.kirupa.com/t/press-two-key-at-a-time/288747/1 "2009-05-20T13:12:52Z")

</div>

How can I use two key at a time :

I wrote this code for single key …

```auto
stage.addEventListener(KeyboardEvent.KEY_DOWN, moving);
function moving(event:KeyboardEvent):void
{
    if (event.keyCode == Keyboard.RIGHT)
    {
        ball.x += 5;
    }
    if (event.keyCode == Keyboard.LEFT)
    {
        ball.x -= 5
    }
    if (event.keyCode == Keyboard.UP)
    {
        ball.y -= 5
    }
    if (event.keyCode == Keyboard.DOWN)
    {
        ball.y += 5
    }
    
}

```

but I want to use two keys at a time :-  
for example:

right + down  
right + Up  
Left + down  
left + Up

so how we can do this thing in AS3.0 ??
