我在使用Greensock TweenMax时间轴的actionscript 3中工作。我有一个页面滚动两个按钮(回到顶部,并停止/播放按钮)。 滚动器会自动播放onLoad,延迟时间为4秒。当我按停止/播放按钮时,它不会停止延迟。它必须等待整整四秒才能发挥作用。此外,4秒延迟仅在滚轮首次运行时发生。每当滚动条重复时,我怎样才能获得4秒的延迟?我怎样才能获得停止/播放按钮来覆盖延迟和播放?我已经为此工作了两天,并尝试了各种技术(循环,定时器,延迟调用等),但都没有成功。如果有人有想法,我将不胜感激。如何覆盖TweenMax中的延迟?
1)开始的时间线代码:
myTween = new TweenMax(content_mc, 60, {delay:4, y:22, ease: Power0.easeNone, onComplete: restartFromTop });
2)该功能控制停止/播放按钮
private function toggler(e:MouseEvent = null):void
{
if (playState == true){
toggleBtn.gotoAndStop(2);
myTween.pause();
playState = false;
trace("MC is now paused and stopped");
}
else if(playState == false) {
myTween.resume();
toggleBtn.gotoAndStop(1);
playState = true;
trace("MC is resumed from pause");
}
}
3)该功能控制卷轴的重新起动时,它重复。
private function restartFromTop():void
{
myTween.restart()
playState = true;
}
4)此功能控制回顶部按钮
private function backToTop(event:MouseEvent):void
{
myTween.reverse();
if (playState == true){
myTween.restart();
myTween.resume();//stop animation
//toggleBtn.gotoAndStop(2);//changes button to pause
toggleBtn.buttonMode = true;
trace("page is scrolling");
}
if (playState == false){
myTween.restart();
myTween.pause();//stop animation
trace("play button is paused");
trace(timer);
}
//Adds a hand cursor on the button and adds a click event to the button.
toggleBtn.buttonMode = true;
toggleBtn.addEventListener(MouseEvent.CLICK, toggler);
}
谢谢。它绝对有助于:) – latoyale