This is how you look for keys.
HIT:
If you call on the code again it will keep creating Listener objects so if you do not want multiple key listeners make sure to remove it before calling it again.
To remove a "Key Listener just do:
Key.removeListener(key_Listener_Function);
Also you can remove the function as well:
///Remove one if there is one so they dont multiply////
delete key_Listener_Function;
Then just call on it again later if you want to turn it back on.
Listen for Enter key:
///Create an object////;
key_Listener_Function = Object();
///On key down...you can change this to keyup/down ect...///;
key_Listener_Function.onKeyDown = function() {
///Which key was pressed///;
trace(Key.getAscii());
if (Key.isDown(Key.ENTER)) {
///What you are looking for///;
trace("enter key pressed");
///Send to Mach////
fscommand("Code", 'X10 Y5.6 Z 5.6');
}
};
///add listener to wait for the key press//;
Key.addListener(key_Listener_Function);
Test it out below:http://alphagraphicdesigns.com/demo/KeyWatchMach.swf