# onKeyDown problem

**URL:** https://forum.kirupa.com/t/onkeydown-problem/306577
**Category:** flash
**Created:** [March 17, 2010, 8:33pm UTC](https://forum.kirupa.com/t/onkeydown-problem/306577 "2010-03-17T20:33:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![satiss](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@satiss](https://forum.kirupa.com/u/satiss)
#### Post date: [March 17, 2010, 8:33pm UTC](https://forum.kirupa.com/t/onkeydown-problem/306577/1 "2010-03-17T20:33:21Z")

</div>

Hello everyone,

I’m having issue with the onKeyDown and addListener. When I export my movie, it work perfectly. But when I embed the movie in a web page, I need to click on the Stage to be able to use the Keyboard. :crazy:

Here’s a preview link: [http://www.satissdesign.com/onKeyDown/](http://www.satissdesign.com/onKeyDown/)

Try to use the keyboard arrow… it work only if you click on the stage one shot before.

Here the AS2 code:

watchKeyBoard = new Object();  
watchKeyBoard.onKeyDown = function() {

```
if (Key.isDown(Key.LEFT)) {
    myText.text = "LEFT";
}
if (Key.isDown(Key.RIGHT)) {
    myText.text = "RIGHT";
}
if (Key.isDown(Key.UP)) {
    myText.text = "UP";
}
if (Key.isDown(Key.DOWN)) {
    myText.text = "DOWN";
}

```

};  
Key.addListener(watchKeyBoard);

Does someone already saw that problem before?

Marc
