Jump to content
GreenSock

notarysojac

'onComplete' function called immediately [SOLVED]

Recommended Posts

When I tried to perform a fromTo tween, the onComplete:myFunction was executed as soon as the tween became active and not after the tween had run its course, as I had expected.

 

According to the existing documentation reference which was not immediately obvious to me, if you're going to do things like add references to onComplete, then you need to associate all such references with the to portion of the Tween declaration - not the from part.

 

WRONG:

 

TweenMax.fromTo(dispObj, tween_duration, 
 { alpha:fromAlpha, 
   ease:tween_func, 
   delay:tween_delay, 
   onComplete:tweenCompleted, 
   onCompleteParams:[nexttweenID] }, 
 { alpha:toAlpha });

 

 

CORRECT:

 

TweenMax.fromTo(dispObj, tween_duration, 
 { alpha:fromAlpha }, 
 { alpha:toAlpha, 
  ease:tween_func, 
  delay:tween_delay, 
  onComplete:tweenCompleted, onCompleteParams:[nexttweenID] });

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