2009-11-11 59 views
0

我試圖讓onComplete(在這種情況下是第5幀)在一系列動畫之後跳到給定的幀。這是我迄今寫的。不應該這樣工作嗎?gotoAndStop與TweenMax同步

stop(); 
import gs.TweenMax; 

import gs.plugins.*; 

TweenPlugin.activate([DropShadowFilterPlugin]); 
import fl.motion.easing.*; 


TweenMax.from (redSquare_mc, 1, {x: 285, alpha: .5, scaleX:.5 } ); 
TweenMax.to(redSquare_mc, 1, {dropShadowFilter:{color:0x000000, alpha:0.5, blurX:17, blurY:18, angle:45, distance:5}}); 


function firstFrame():void 
{ 

    TweenMax.from (yellowCircle_mc, 3, {x: 600, scaleX: 1, scaleY: 1, alpha: 1, delay: .125}) 
    TweenMax.to (yellowCircle_mc, 3, {x: 300, scaleX: .5, scaleY: .5, alpha: .5, ease:Back.easeInOut, delay: 2, onComplete: toNextFrame}); 

} 
firstFrame(); 

function toNextFrame():void 
{ 
    gotoAndStop("5"); 
} 
+0

你會得到什麼錯誤?你是否試圖跳到同一幀你停下來?你也可以把你的代碼放在適當的標籤中,讓它突出顯示並使閱讀更容易。 – greggreg 2009-11-11 05:35:09

回答

4

變化gotoAndStop("5")gotoAndStop(5)。該函數爲幀標號的幀號和字符串參數使用Number參數。

1

你必須發送param數組函數來完美工作。

stop(); 
import gs.TweenMax; 

import gs.plugins.*; 

TweenPlugin.activate([DropShadowFilterPlugin]); 
import fl.motion.easing.*; 


TweenMax.from (redSquare_mc, 1, {x: 285, alpha: .5, scaleX:.5 } ); 
TweenMax.to(redSquare_mc, 1, {dropShadowFilter:{color:0x000000, alpha:0.5, blurX:17, blurY:18, angle:45, distance:5}}); 


function firstFrame():void 
{ 

    TweenMax.from (yellowCircle_mc, 3, {x: 600, scaleX: 1, scaleY: 1, alpha: 1, delay: .125}) 
    TweenMax.to (yellowCircle_mc, 3, {x: 300, scaleX: .5, scaleY: .5, alpha: .5, ease:Back.easeInOut, delay: 2, onCompleteParams:[yellowCircle_mc],onComplete: toNextFrame}); 

} 
firstFrame(); 

function toNextFrame(mc:MovieClip):void 
{ 
    gotoAndStop("5"); 
}