【发布时间】:2013-02-22 00:24:26
【问题描述】:
好的,所以我正在用 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
}
我的意思是,有没有办法解决这个问题?我怎样才能用勾号制作动画!
【问题讨论】:
-
你的代码没问题。刻度处理程序工作正常。你到底有什么问题?你能给我一个链接到你的来源吗?
-
我的问题是我有一个动画移动帧,在鼠标按下处理程序上我插入 gotoandplay 并在动画结束时循环播放,我的问题是它只播放一次并且不循环.
-
好的,给我一个你的源链接。愿意帮忙。究竟是什么,我不能在没有看到代码的情况下发布明确的答案。
-
我用的代码在那里。
-
我试过你的代码运行,没有问题。刻度处理程序工作得很好。你对象的结构如何,比如我需要的Movieclip里面的时间线信息。需要完整来源。
标签: actionscript-3