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
Post a Comment