Jump to content
Search Community

how to change myTween.delay

biyibird test
Moderator Tag

Recommended Posts

hi,greensock!

i am from china and my english is poor. this is my test code.

i want Increasing the myTween.delay,and let the mc to rotate more and more late. but now it is seems not to be hoped of mine.

 

var myTween:TweenMax;
	var _delay:Number = 0;
	public function test_mcCut()
	{
		myTween = TweenMax.to(mc,1.8,{rotation:180,scaleX:0.1,scaleY:0.1,delay:_delay,onComplete:onCompleteH,paused:true});
		btn.addEventListener(MouseEvent.CLICK,clickH);
	}

	public function clickH(e:MouseEvent)
	{
		myTween.play();
	}

	public function onCompleteH()
	{
		myTween.currentProgress = 0;///////return to start
		myTween.pause();
		_delay +=  3;
		myTween.delay = _delay;/////////this is my question----the Increasing  of myTween.delay just=3,not to Increasing  more biger
		trace(myTween.delay);
	}

Link to comment
Share on other sites

It's a logic problem in your code - when you set myTween.currentProgress = 0, that makes the tween go to the point at which it BEGINS (no delay included). So if you play() right after you set currentProgress to 0, it would immediately begin tweening (as it should). It wouldn't have any delay. If you want to restart the tween INCLUDING the delay, just use the parameter in the restart() method, like this:

 

function onCompleteH() {
   myTween.restart(true);
   myTween.pause();
   _delay +=  3;
   myTween.delay = _delay;
   trace(myTween.delay);
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...