# Keyboard listener not making sense

**URL:** <https://forum.kirupa.com/t/keyboard-listener-not-making-sense/284498>\
**Category:** flash\
**Created:** [March 19, 2009, 5:55pm UTC](https://forum.kirupa.com/t/keyboard-listener-not-making-sense/284498 "2009-03-19T17:55:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tsukiyomi](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@Tsukiyomi](https://forum.kirupa.com/u/Tsukiyomi)\
**Post date:** [March 19, 2009, 5:55pm UTC](https://forum.kirupa.com/t/keyboard-listener-not-making-sense/284498/1 "2009-03-19T17:55:31Z")

</div>

I’m trying to understand the keyboard listeners and make something that will bring up a dialogue box whenever someone types a specific phrase. This is my code:

```auto

package {
    import flash.display.Stage;
    import flash.events.Event;
    import flash.events.KeyboardEvent;
    //
    public class KeyLogger {
        private var keys:String = "";
        private var phrase:String = "pass";
        public function KeyLogger(stage:Stage):void {
            stage.addEventListener(KeyboardEvent.KEY_DOWN, keyReleased);
        }
        //
        private function keyReleased(e:KeyboardEvent):void {
            keys += String.fromCharCode(e.keyCode);

            if (keys == phrase) {
                   showBox();
            }

            trace(keys);
        }
        //
        private function showBox():void {
             //
        }
    }
}

```

The weird thing is the listener seems to be capturing key presses, but not all of them. I tried every letter a-z then the numbers on the keyboard and it only grabbed these:

DGUWX1234567890

Is there something I’m unaware of about these keys that would cause this?
