使用 TweenMax 完成 gotoAndStop

发布于 2024-08-10 18:54:15 字数 747 浏览 8 评论 0原文

我试图让 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");
}

I'm trying to get onComplete (frame 5 in this case) to skip to a given frame after a series of animations. Here is what i have written so far. Shouldn't this work?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝天白云 2024-08-17 18:54:15

gotoAndStop("5") 更改为 gotoAndStop(5)。该函数采用数字参数作为帧编号,使用字符串参数作为帧标签。

Change gotoAndStop("5") to gotoAndStop(5). The function takes Number arguments for frame numbers and String arguments for frame labels.

樱花落人离去 2024-08-17 18:54:15

您必须在函数上发送参数数组才能完美工作。

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

you have to send param array on function to work perfectly.

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");
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文