TweenMax frame & onComplete 问题
TweenMax frame & onComplete issue
我的时间有问题。我需要让 grape MovieClip 在例如 10 秒内到达最后一帧,然后更改动画,但是在 grape MC 达到第 11 帧后 onComplete 会触发!有一些 onTimeOut 参数吗?我到处搜索,尝试了很多解决方法,但没有一个是完美的,它要么在计时器用完之前完成所有动画,反之亦然。
private function changeAnimation():void
{
if (currentGrapeNumber > 0)
{
TweenMax.killTweensOf(grapes["Grape" + currentGrapeNumber]);
if (currentGrapeNumber == 30)
{
return;
}
}
currentGrapeNumber++;
currentAnimation = TweenMax.to(grapes["Grape" + currentGrapeNumber], minutesPerGrape * 60, { frame:11, onComplete:changeAnimation });
}
编辑 1:有变量 currentAnimation,因为用户可以按下暂停按钮。我现在正在尝试使用自己的可暂停计时器 class 作为解决方法,但仍然希望有一种不使用计时器的方法。
编辑 2:涉及计时器,因为应用程序有倒计时。
问题已解决,我只是将其添加到 updateClock 方法中:
private function updateClock(e:TimerEvent):void
{
secondsToSwitch--;
if (secondsToSwitch == 0)
{
secondsToSwitch = Math.round(minutesPerGrape * 60);
changeAnimation();
}
/**
* Function body
*/
}
并在 changeAnimation 方法中更改 TweenMax.to():
currentAnimation = TweenMax.to(grapes["Grape" + currentGrapeNumber], minutesPerGrape * 60, { frame:11 });
但是。如果你在 TweenMax 中有一个替代或一些神秘的 "onTimeOut" 参数 - 随意 post 它:)
我的时间有问题。我需要让 grape MovieClip 在例如 10 秒内到达最后一帧,然后更改动画,但是在 grape MC 达到第 11 帧后 onComplete 会触发!有一些 onTimeOut 参数吗?我到处搜索,尝试了很多解决方法,但没有一个是完美的,它要么在计时器用完之前完成所有动画,反之亦然。
private function changeAnimation():void
{
if (currentGrapeNumber > 0)
{
TweenMax.killTweensOf(grapes["Grape" + currentGrapeNumber]);
if (currentGrapeNumber == 30)
{
return;
}
}
currentGrapeNumber++;
currentAnimation = TweenMax.to(grapes["Grape" + currentGrapeNumber], minutesPerGrape * 60, { frame:11, onComplete:changeAnimation });
}
编辑 1:有变量 currentAnimation,因为用户可以按下暂停按钮。我现在正在尝试使用自己的可暂停计时器 class 作为解决方法,但仍然希望有一种不使用计时器的方法。
编辑 2:涉及计时器,因为应用程序有倒计时。
问题已解决,我只是将其添加到 updateClock 方法中:
private function updateClock(e:TimerEvent):void
{
secondsToSwitch--;
if (secondsToSwitch == 0)
{
secondsToSwitch = Math.round(minutesPerGrape * 60);
changeAnimation();
}
/**
* Function body
*/
}
并在 changeAnimation 方法中更改 TweenMax.to():
currentAnimation = TweenMax.to(grapes["Grape" + currentGrapeNumber], minutesPerGrape * 60, { frame:11 });
但是。如果你在 TweenMax 中有一个替代或一些神秘的 "onTimeOut" 参数 - 随意 post 它:)