# KeyboardEvent

**URL:** <https://forum.kirupa.com/t/keyboardevent/281573>\
**Category:** flash\
**Created:** [February 10, 2009, 9:19pm UTC](https://forum.kirupa.com/t/keyboardevent/281573 "2009-02-10T21:19:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![webbhelp](https://avatars.discourse-cdn.com/v4/letter/w/4bbf92/32.png) [@webbhelp](https://forum.kirupa.com/u/webbhelp)\
**Post date:** [February 10, 2009, 9:19pm UTC](https://forum.kirupa.com/t/keyboardevent/281573/1 "2009-02-10T21:19:30Z")

</div>

Hi!

I got problem with this code:

```auto
ob.addEventListener(KeyboardEvent.KEY_DOWN, kdown);

function kdown(evt:KeyboardEvent)
{

trace('CLEAR');

    if(evt.keyCode == Keyboard.LEFT)
    {
        ob.x -= 5;
    }

    
    if(evt.keyCode == Keyboard.RIGHT)
    {
        ob.x += 5;
    }

}

```

I have a MovieClip with Instance name: ob

The function never begins when i press on keyboard.  
trace(‘CLEAR’); never begins, can you find the problem?

Thanks //WebbHelp
