Key codes!

Subscribe to Key codes! 10 posts

avatar for cmproductions cmproductions 1 post
Flag Post

Hey guys does anyone know where I can get a list of the key codes?
e.g. “Key.isDown(35)” and all the number codes.

Sorry I know I could just look it up but I don’t have much time and I have to go to sleep! I’ll check the thread in the morning.

Thanks to everyone who posts!

 
avatar for pixtiz pixtiz 92 posts
Flag Post

you can search in Flash Help (Help can help sometimes you know).

My entries are in french but search for “Key.getCode” and look in the “AS 2.0 formation” section ;)

 
avatar for arcaneCoder arcaneCoder 2354 posts
Flag Post

Heres the page from the online version of the Flash help: Keyboard Keys and Key Code Values

 
avatar for IndieFlashArcade IndieFlashAr... 433 posts
Flag Post

What I did, personally, is write a very simple .swf file (as detailed in the Flash help files) that traces the key code of any key that you press. Wow, it just doesn’t get any easier than that…

 
avatar for Mauser Mauser 25 posts
Flag Post

“What I did, personally, is write a very simple .swf file (as detailed in the Flash help files) that traces the key code of any key that you press. Wow, it just doesn’t get any easier than that…”

Wow! Smart idea!

Although thanks arcaneCoder fir the link. I’ll definitely be using that reference! =)

mauser

 
avatar for richpixel richpixel 4 posts
Flag Post

So what I did, after getting tired of always looking key codes up was write a KeyCode class which I include with my games. So when you want the “b” key, you just do this: “Key.isDown(KeyCode.B)”

class KeyCode
{
	static public var SPACE:Number = 32;
	static public var UP:Number = 38;
	static public var DOWN:Number = 40;
	static public var LEFT:Number = 37;
	static public var RIGHT:Number = 39;
	
	static public var A:Number = 65;
	static public var B:Number = 66;
	static public var C:Number = 67;
	static public var D:Number = 68;
	static public var E:Number = 69;
	static public var F:Number = 70;
	static public var G:Number = 71;
	static public var H:Number = 72;
	static public var I:Number = 73;
	static public var J:Number = 74;
	static public var K:Number = 75;
	static public var L:Number = 76;
	static public var M:Number = 77;
	static public var N:Number = 78;
	static public var O:Number = 79;
	static public var P:Number = 80;
	static public var Q:Number = 81;
	static public var R:Number = 82;
	static public var S:Number = 83;
	static public var T:Number = 84;
	static public var U:Number = 85;
	static public var V:Number = 86;
	static public var W:Number = 87;
	static public var X:Number = 88;
	static public var Y:Number = 89;
	static public var Z:Number = 90;
	
	
	static public var ONE:Number = 49;
	static public var TWO:Number = 50;
	static public var THREE:Number = 51;
	static public var FOUR:Number = 52;
	static public var FIVE:Number = 53;
	static public var SIX:Number = 54;
	static public var SEVEN:Number = 55;
	static public var EIGHT:Number = 56;
	static public var NINE:Number = 57;
	static public var ZERO:Number = 48;
	
}
 
avatar for arcaneCoder arcaneCoder 2354 posts
Flag Post

So what I did, after getting tired of always looking key codes up was write a KeyCode class which I include with my games.

Ya, I did the same thing. I just bind keys (or macros) to functions using a single command in the key manager. It takes care of all the repeat/non repeat issues, as well as the flash multi-key pressing complications.

 
avatar for Mauser Mauser 25 posts
Flag Post

Thanks for the source richpixel!

 
avatar for IndieFlashArcade IndieFlashAr... 433 posts
Flag Post

Wow, it just doesn’t get any easier than that…


Thanks to RichPixel for proving me wrong :)

 
avatar for Mauser Mauser 25 posts
Flag Post

Using the key codes I just finished a ‘’change through your weapons’‘/’’next/prev weapon) controller! All I have to do is add it to my next project! =)

I used E (69) and Q(89).