Custom XKey Class 2005-11-18 04:21:42
custom XKey class
sure, youve all seen people asking how to get their Key.isDown functions to work properly. well, for no one in particular, ive created a class called XKey, which is an extended key mapping to simplify the process.
note: this is not necessary for anyone who knows how to use a Key.isDown() function properly, or anyone who is only checking for one or two keys. this extended mapping includes 50 extra keys, so its a bit of overkill...
how to use:
download the zipped file here: XKey.zip
(sorry for using that god-awful site. i didnt know where else to put it)
extract the XKey.as file to the same directory as your fla file.
how to call the file from within your fla:
var exKey:XKey = new XKey();
this will give the variable exKey all the methods of the XKey class.
in order to check for a key down, just call the corresponding method:
(this code will check to see if the A key has been pressed down)
its that simple. the available keys are as follows:
A thru Z, called with A() thru Z()
0 thru 9 (above the home keys), called with KEY_0() thru KEY_9()
0 thru 9 (on the numpad), called with NUM_0() thru NUM_9()
+ and - (above the home keys), called with PLUS() and MINUS()
+ and - (on the number pad), called with NUM_PLUS() and NUM_MINUS()