Jump to content
GreenSock

Mich

New Tweens with onComplete function in a for loop

Recommended Posts

Hi All,

 

i try to create multiple tweens with a for... loop (its' working fine) with a onComplete function (this one doesn't work), the "loopMe" is called but the tween reverse never applies...

In short words : i want that the 14 movies loops indefinitely :)

 

loopMe = function (myTween) {
myTween.reverse(); -> i tried also eval(myTween) 
//trace(myTween); -> shows leTween3, leTween 8...
};
for (var i = 1; i<14; i++) {
_global["leTween"+i] = new TweenMax.to(this["t"+i], 3, {_alpha:100, ease:Strong.easeIn, onComplete:loopMe, onCompleteParams:["_global.leTween"+i]}); --> i tried also  onCompleteParams:[_global["leTween"+i]]
}

 

thanks for any help !

Link to comment
Share on other sites

Ok, i added parameters "yoyo:true, repeat:10" in the for loop and it works. But i'm still interested in how controlling a tween created dynamically in the for loop with any other function...

Link to comment
Share on other sites

You're using the wrong syntax.

 

BAD: new TweenMax.to(...);

GOOD: new TweenMax(...);

ALSO GOOD: TweenMax.to(...);

 

And your onCompleteParams should be: onCompleteParams:[_global["leTween"+i]]

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.
×