AS3.0 监听键盘事件问题。
1个回答
展开全部
下面是代码, 放到第一帧就行了,
import flash.events.KeyboardEvent;
stop();
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyboardHandle);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyboardHandle);
function onKeyboardHandle(evt: KeyboardEvent)
{
if(evt.keyCode == 68)
{
switch(evt.type)
{
case KeyboardEvent.KEY_DOWN:
this.gotoAndStop(2);
break;
case KeyboardEvent.KEY_UP:
this.gotoAndStop(1);
break;
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询