View Full Version : Getting Keyboard Input
TehCodr
03-29-2010, 07:37 PM
Hi, I'm a newbie flash/actionscript user, and I was wondering, how do I make the enter key send the game to the next frame? I tried Key.ENTER = function() {
gotoAndStop(2)
}
But that didn't work.
...please help...
Artwich
03-29-2010, 08:05 PM
AS2:keyListener=new Object();
keyListener.onKeyDown=function(){
if(Key.isDown(Key.ENTER)gotoAndStop(2);
};
Key.addListener(keyListener);
AS3:addEventListener(KeyboardEvent.KEY_DOWN,keyHan dler);
function keyHandler(e:KeyboardEvent):void{
if(e.keyCode==Keyboard.ENTER)gotoAndStop(2);
}
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.