2013-02-22 47 views
0

好的,所以我正在開發Adobe Flash(空氣)遊戲的過程中,它將成爲一款手機遊戲。前一段時間我問了這個問題,但動畫並不工作,所以知道我回來了。無論如何,我遇到的問題是,當我按下一個按鈕時,沒有持續的移動,所以我必須不斷地按下按鈕移動。該人告訴我使用刻度,所以這就是我內置的運動引擎,各地ticks.When我去加我的動畫,它會一次,只是停止(動畫),這裏是我的代碼:觸摸移動將不會生成動畫

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 
} 

我想說的是,反正是有解決這個問題?我怎樣才能使用勾號動畫!

+0

你是代碼沒問題。滴答處理工作正常。究竟你有什麼問題?你能給我一個鏈接到你的來源? – 2013-02-22 00:31:51

+0

我的問題是,我有一個動畫移動框架,在鼠標放下處理程序時,我插入gotoandplay,並在動畫結束時循環,我的問題是它只播放一次,不循環。 – user1666767 2013-02-22 00:33:00

+0

好吧,給我一個你的源鏈接。願意幫助。確切地說,我不能在沒有看到代碼的情況下發布明確的答案。 – 2013-02-22 00:34:56

回答

0

和其他人一樣,我覺得代碼非常好。因爲我沒有訪問完整的代碼和時間線,所以我對這個問題有如下猜測:

因爲,你只需要在鼠標下面開始動畫,那麼你必須有一個stop()動作動畫的第一幀。 (如果不是這樣,請糾正我)。您的動畫的最後一幀必須再次執行gotoAndPlay(x)動作才能進行循環。

基於上述假設,當您的動畫循環時,它再次達到已定義stop()動作的幀。

+0

那麼我該如何解決這個問題? – user1666767 2013-03-31 14:08:48