# KeyboardEvent bug?

**URL:** <https://forum.kirupa.com/t/keyboardevent-bug/228906>\
**Category:** flash\
**Created:** [June 12, 2007, 1:52pm UTC](https://forum.kirupa.com/t/keyboardevent-bug/228906 "2007-06-12T13:52:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shiroi](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@Shiroi](https://forum.kirupa.com/u/Shiroi)\
**Post date:** [June 12, 2007, 1:52pm UTC](https://forum.kirupa.com/t/keyboardevent-bug/228906/1 "2007-06-12T13:52:55Z")

</div>

Hello, I am kinda new to AS3 and I’m starting to learn it slowly but surely. But it seems that there are some “new kind” of errors I cannot find what is the problem. It seems also that I can’t try a few tutorials on my Flash CS3 for AS3 they bug.

Here is the class i have been trying. The file is named keyTest.as

```auto

package {
    import flash.display.Sprite;
    import flash.display.events.KeyboardEvent;
    
    public class keyTest extends Sprite {
        
        public function example() {
            stage.focus = this;
            addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
        }
        
        private function onKeyDown(event:KeyboardEvent):void {
            trace("Key : " + event.charCode);
        }
    }
}

```

When I compile it returns me the following error

1046: Type was not found or was not a compile-time constant: KeyboardEvent.

On this line : private function onKeyDown(event:KeyboardEvent):void {

Please tell me what I am doing wrong ^^" (I tried to delete the ASO files like recommended in the FAQ but didn’t work either).

PS : Sorry if my English or the terms I use are bad.
