Registering a command to a key


i want add command key , want know how this. example, if user presses key, move 1 frame or forward frame. can tell me actionscript this?

you need add event listener first:

 

stage.addeventlistener(keyboardevent.key_down, keydownhandler);

 

and define function

 

function keydownhandler(e:keyboardevent):void

{

     switch(e.keycode)

     {

          case keyboard.w:

               // something

               break;

     }

}

 

that define command w key. keyboard class has many constants keys.



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Warning, the Safe Path is not accessible vm3 - Joomla! Forum - community, help and support

uppercase letters in url - Joomla! Forum - community, help and support

Joomla! Update is not offering Joomla 3 - Joomla! Forum - community, help and support