|
||||||||||||||
. . . . . |
Flash 8 Keycodes keyListenerI have just found all my keycodes for the key strokes on the keyboard for flash 8. Using the numbers is a lot easier than trying to suss out what the proper code is for using a particular letter or number key. This is useful for games for controlling the characters or cars or for a fighting game like i used in my fighting bananas game . In that game i did not use a keyListener which is a much better way of doing things. I will show you one later and how to use it. It is a lot better and simpler than what I had done back in those dinosaur days. The way that I did it is not the best way to do it. I have used clipEvents on the movieclips which is a bad idea and also I have used an onEnterFrame loop which is constantly looping waiting for a keystroke. The listener is much better and saves heaps of resources.
Flash Tutorials in Video Format -
Watch them now at LearnFlash.com
Now for the keycodes. Wait for it , it is a long list:
Numbers
Here is an example of a keyListener and how you can use the ascii keycodes in Flash Actionscript programming:
// key listener..
keyListener = new Object(); // make key listener object
// this function gets triggered whenever a key is pressed
keyListener.onKeyDown = function() {
var keyCode = Key.getCode(); // get the key code
if (keyCode == 87) { // W
// do something
blah_mc._alpha -= 10;
}
} else if (keyCode == 83) { // S
// move car left
car_mc._x -= 10;
}
} else if (keyCode == 68) { // D
car_mc.gotoAndStop(3);
}
};
Key.addListener(keyListener); // notify Key object about your listener
Flash 8 keycode Resources
banana fighting game . |
|
||||||||||||
|
. | Home | Flash MX | Actionscript 2.0 | Flash 3D | Flash 8 | Flash Database | Flash Mobile | Flash CS3 | Java For Kids | Video Course | General Video | Photoshop | Web Design | Digital Photography | Games | free backgrounds | Resume | Streaming Video | Students Work | Links | Contact me | sitemap | reviews | . . |
||||||||||||||