Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

onComplete function not being called when using onUpdate

Recommended Posts



I tried to use onUpdate and onComplete in the same tween and I realized that onComplete function is not being called

in this case, maybe it has been overwritten? If I try to do the same thing with Tweener it works, just not with TweenMax...


TweenMax.to($block, .2, { onUpdate:changeColor, onUpdateParams:[$block], onComplete:changeComplete, onCompleteParams:[$block]} );


Tweener.addTween($block, {time:.2, onUpdate:changeColor, onUpdateParams:[$block], onComplete:changeComplete, onCompleteParams:[$block]});


Anyone ran into this problem before?




Link to comment
Share on other sites

I would absolutely love to see an example that works in Tweener but not with TweenMax. Can you post a super simple FLA? You can most definitely use an onUpdate and onComplete. No problem. It's tough to say if it's an overwrite thing because I don't see the other tweens you've got going. But if you overwrite all tweenable properties of a tween, it will be killed (hence, the onComplete won't fire). That's by design. You are using the latest version of the platform, right? Just checkin' :)

Link to comment
Share on other sites

yeah I'm using the latest version, and I tried to set overwrite to none, still doesnt work.

I've attached the files, using Tweener just for that line now, and I commented out TweenMax.


Link to comment
Share on other sites

I noticed several things:


1) Your TweenMax onUpdate was calling a non-existent method. I changed it to call "jitter" which is what you used for the Tweener call.


2) The TweenMax in your jitter() method was indeed overwriting the one that had the onUpdate. As indicated in the docs, if a tween overwrites a portion of another one and there are no more tweening properties left in that [previously existing] tween, it will be killed. Otherwise, onComplete callbacks would be triggered from overwritten tweens (not typically desirable). Your initial tween actually has no tweening properties whatsoever (rather odd). Looks like you're just using it for onUpdate and onComplete calls. So after the new tween is created, TweenMax says "here's an overlapping tween of that same object...are there any tweening properties left after the overwrite analysis? Nope. Okay, kill it."


All you need to do is add overwrite:false to the tween you're creating inside your jitter() method and you'll be fine. That'll keep it from overwriting the first one.


Once I made those two changes, everything seemed to work just fine.


I'm not sure why you're doing a zero-duration TweenMax inside jitter() instead of just directly setting the necessary value(s). It would certainly be more efficient. Not necessary, though - just thought I'd mention it.

Link to comment
Share on other sites

Thanks for the help!


The first one is because I changed the function name before I compressed it, haha sorry about that.


The reason I set the time to 0 is because I want it to happen right away? Then I guess I'm not really tweening

anyways, should just use colortransform.


Thanks again :)

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.