好的,所以我正在用 Adobe Flash (air) 开发一个游戏,这将是一个手机游戏。我前一段时间问过这个问题,但是动画不起作用所以知道我回来了。无论如何,我遇到的问题是当我按住一个按钮时没有连续移动,所以我必须不断按下按钮才能移动。那个人告诉我使用滴答声,所以这就是我构建运动引擎的方式,围绕着滴答声.当我去添加我的动画时,它会运行一次然后停止(动画)这是我的代码:
myButton.addEventListener(MouseEvent.MOUSE_DOWN,mouseDown);
function mouseDown(e:Event):void {
stage.addEventListener(MouseEvent.MOUSE_UP,mouseUp); //listen for mouse up on the stage, in case the finger/mouse moved off of the button accidentally when they release.
addEventListener(Event.ENTER_FRAME,tick); //while the mouse is down, run the tick function once every frame as per the project frame, this is where I add the players animation.
}
function mouseUp(e:Event):void {
removeEventListener(Event.ENTER_FRAME,tick); //stop running the tick function every frame now that the mouse is up
stage.removeEventListener(MouseEvent.MOUSE_UP,mouseUp); //remove the listener for mouse up
}
function tick(e:Event):void {
//do your movement
}
我的意思是,有没有办法解决这个问题?我怎样才能用勾号制作动画!