PDA

View Full Version : Commands with the "Shift" key.


Thunderfudge
07-03-2009, 06:50 AM
Sorry if this is "too" simple, but I'm a complete newbie :o
I have been trying to code something to stay on the first keyframe of the animation, until the "Shift" key is pressed, after which it plays through once, and then becomes available to be played again. I can get it to work with a mouse click, but I'm having trouble doing it with shift...Any help appreciated, Thanks in Advance

dcaccavella
07-04-2009, 05:08 AM
here, play with this:


addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);

function keyDownHandler(e:KeyboardEvent)
{
// the e variable contains data on which keystroke it is. Play with this, and then use operators to determine if it was the shift key, and then do the action.

trace(e.toString());
}


Hope this helps