stage.addEventListener(KeyboardEvent.KEY_DOWN, onKey);
function onKey(e:KeyboardEvent):void{
if (e.keyCode == Keyboard.LEFT) {
ball_mc.x -= 5;
}
if (e.keyCode == Keyboard.RIGHT) {
ball_mc.x += 5;
}
if (e.keyCode == Keyboard.UP) {
ball_mc.y -= 5;
}
if (e.keyCode == Keyboard.DOWN) {
ball_mc.y += 5;
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น