I think you'd enjoy ActionScript for Flash MX: The Definitive Guide by Colin Moock, it is by far the best and most comprehensive book on actionscript i've seen. It also has a massive function reference that shows the syntax and potential bugs along with practical examples for just about every function/object in actionscript.
To detect key presses you might create an object that "listens" for events triggered by the Key object, this object can then respond accordingly,
Code:var kl = {}; // create a new object {} is a shorthand for new Object(); // define a method to be triggered when an onKeyDown event happens kl.onKeyDown = function() { switch (Key.getCode()) { // what happens depends on which key was pressed case 32: // 32 = the space key was pressed trace("space"); break; case 49: trace(1); break; case 50: trace(2); break; } }; // make the kl object a listener of the key object, // (so each time the key object broadcasts a message saying // a keyDown event happened the kl object will know about it Key.addListener(kl);




Reply With Quote