与TweenMax一起使用gotoAndStop oncomlete

时间:2009-11-11 05:09:15

标签: flash actionscript-3 actionscript tween

我正在尝试使用onComplete(在这种情况下为第5帧)在一系列动画之后跳转到给定的帧。这是我到目前为止所写的内容。这不应该起作用吗?

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");
}

2 个答案:

答案 0 :(得分:4)

gotoAndStop("5")更改为gotoAndStop(5)。该函数采用帧号的Number参数和帧标签的String参数。

答案 1 :(得分: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");
}