flash中怎么用键盘控制物体
2个回答
展开全部
//例如用光标控制物体(影片剪辑)向上下左右移动:
mc1.onEnterFrame=function(){//mc1为影片剪辑的实例名
if(Key.isDown(Key.LEFT)){
this._x-=5;
}
if(Key.isDown(Key.RIGHT)){
this._x+=5;
}
if(Key.isDown(Key.UP)){
this._y-=5;
}
if(Key.isDown(Key.DOWN)){
this._y+=5;
}
}
mc1.onEnterFrame=function(){//mc1为影片剪辑的实例名
if(Key.isDown(Key.LEFT)){
this._x-=5;
}
if(Key.isDown(Key.RIGHT)){
this._x+=5;
}
if(Key.isDown(Key.UP)){
this._y-=5;
}
if(Key.isDown(Key.DOWN)){
this._y+=5;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询