# Menu detects keystrokes in "Test", but not Live?

**URL:** <https://forum.kirupa.com/t/menu-detects-keystrokes-in-test-but-not-live/323392>\
**Category:** flash\
**Created:** [June 28, 2011, 8:59pm UTC](https://forum.kirupa.com/t/menu-detects-keystrokes-in-test-but-not-live/323392 "2011-06-28T20:59:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mugsy323](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@Mugsy323](https://forum.kirupa.com/u/Mugsy323)\
**Post date:** [June 28, 2011, 8:59pm UTC](https://forum.kirupa.com/t/menu-detects-keystrokes-in-test-but-not-live/323392/1 "2011-06-28T20:59:58Z")

</div>

I’m sure there is a simple fix, but this is my first attempt to create a Flash Menu that supports both Mouse and **keyboard** input.

I’ve created a simple Flash based menu (ONE frame, 7 layers) with a Keylistener on the first frame of my “background” layer. I have it setup with six links/buttons. Clicking a button opens that URL. And **in “Test” mode** from the Flash Editor, pressing 1 thru 6 on the keyboard launches the specified link as well.

But **after I publish/upload my file, it no longer detects any keystrokes.** I suspected this was because the animation was playing just one frame and stopping, but the animation is set to loop. I also tried adding a second frame and adding a “gotoandplay(1);”, but that didn’t work either.

I seem to remember running into a problem like this before but can’t remember what the solution was. Anyone?

```auto
KeyListener = new Object();
var myKey;
KeyListener.onKeyDown = function() {
    myKey = Key.getAscii();
    if (myKey == 49) getURL("http://aaaaa.com"); // Typed the "1" key.
    if (myKey == 50) getURL("http://bbbbb.com");
    if (myKey == 51) getURL("http://cccccc.com");
}
Key.addListener(KeyListener);

```
