all groups > flash (macromedia) > september 2007 >
You're in the

flash (macromedia)

group:

Using the Keyboard for navigation



Using the Keyboard for navigation lukeduke7
9/7/2007 5:28:08 PM
flash (macromedia): I have a button I was using but am now trying to get all the script into one
spot on the main frame. I haven't done this before usually have script on
buttons and other places. The button, called btnContinue, had this ation
applied to it:

on (release, keyPress "space"){
play();
}

I want to do the same thing in actionscript. I know how to get the button to
play, but how do I script things to have the spacebar do the same? This is
probably pretty basic but I am just starting to wrap my head around AS2
possibilities and scripting. great stuff.

btnContinue.onRelease = function();
play();
};

Thanks for the help!
Luke
Re: Using the Keyboard for navigation dzedward
9/7/2007 5:38:38 PM
..

var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.getCode() == Key.SPACE) {
play();
}
};
Re: Using the Keyboard for navigation lukeduke7
9/7/2007 5:47:00 PM
Perfect! Again, big Thanks Dze!

Re: Using the Keyboard for navigation dzedward
9/7/2007 5:52:30 PM
AddThis Social Bookmark Button