# Keyboard Events

**URL:** <https://forum.kirupa.com/t/keyboard-events/318296>\
**Category:** Uncategorized\
**Created:** [January 15, 2011, 11:02pm UTC](https://forum.kirupa.com/t/keyboard-events/318296 "2011-01-15T23:02:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amzipotatosheep](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@Amzipotatosheep](https://forum.kirupa.com/u/Amzipotatosheep)\
**Post date:** [January 15, 2011, 11:02pm UTC](https://forum.kirupa.com/t/keyboard-events/318296/1 "2011-01-15T23:02:17Z")

</div>

Hi all, currently learning AS3 and having a bit of trouble with keyboard events. I feel like I understand how they work, but something about my implementation is faulty. This is basically the code I currently have, and I can’t find an error in it based on tutorials and such that I’ve looked up:

```auto

package {
	import flash.events.KeyboardEvent
	import flash.display.MovieClip
	public class Main extends MovieClip {
		public function Main() {
			this.addEventListener(KeyboardEvent.KEY_DOWN,KP)
		}
		private function KP(e:KeyboardEvent):void{
			trace('you pressed a key')
		}
	}
	
}

```

When I run it and pound my keyboard repeatedly nothing happens though ☹

It’s probably just a simple error, but I’m completely at a loss, so help would be much appreciated.
