# Why can't I use some of the keys?!

**URL:** https://forum.kirupa.com/t/why-cant-i-use-some-of-the-keys/304920
**Category:** programming
**Created:** [February 16, 2010, 2:47pm UTC](https://forum.kirupa.com/t/why-cant-i-use-some-of-the-keys/304920 "2010-02-16T14:47:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![SticksStones](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@SticksStones](https://forum.kirupa.com/u/SticksStones)
#### Post date: [February 16, 2010, 2:47pm UTC](https://forum.kirupa.com/t/why-cant-i-use-some-of-the-keys/304920/1 "2010-02-16T14:47:00Z")

</div>

Hi all,

I’m not sure if this is the best place to post. Sorry if it’s not!

I’ve tried 4 or 5 different way’s of grabbing keyboard input in flash AS3, but each time I can get the cursor keys, shift, space, the number keys and the numpad, but I can’t get any of the character keys “q,w,e,r,t,y,etc…” or the enter key to trace any output!

Has anyone come across this before?!

I know I’ve been able to use the character keys and enter in the past!

Could it be something to do with my keyboard or have I forgotten something in Flash?

Here’s the current code I’m using. This works with some keys and not others, just like every other attempt I’ve made!

```auto
		public var pressedKeys:Object = {};
		 
		function keyDownHandler( e:KeyboardEvent ):void
		{
			// The keyDown event is repeatedly fired while a key is
			// held down, so we can do this to ensure we only deal with
			// the event the first time a key is pressed.
			if( pressedKeys[e.keyCode] )
			{
				return;
			}
			
			pressedKeys[e.keyCode] = 1;
			
			//
			
			trace( "KEY PRESSED" );
			traceEvent( e );
		}
		 
		function keyUpHandler( e:KeyboardEvent ):void
		{
			delete pressedKeys[e.keyCode];
			
			trace( "KEY RELEASED" );
			traceEvent( e );
		}
		 
		function traceEvent( e:KeyboardEvent ):void
		{
			trace( "keyCode ", e.keyCode );
			trace( "charCode ", e.charCode );
			trace( "character ", String.fromCharCode( e.charCode ) );
			trace( "" );
		}

```

Thanks
