Jump to content


tween lite callback function not called consistent number of times

Moderator Tag

Recommended Posts

I'm writing an app thatdoes a zoom in and out around a point. To do this I registered a callback function that does a matrix transform. Everything is working great except for the fact that the cllback is called an inconsistent number of times. For a 1 second duration at 24 frames per second the function is called between 23-25 times. Is this a bug or should I be doing something different? I would think the number of times the callback is called would be equal to duration * frameRate. Below is the call I am using:


TweenLite.to(target, this.duration, {ease:Elastic.easeOut , onUpdate:MotionUtil.zoomOut, onUpdateParams:[ target, scaleIncrement, _origin, _originalScale ], onComplete:onComplete });


Thanks in advance for any help you can offer.

Link to comment
Share on other sites

Nope, I'm pretty sure it's not a bug. Keep in mind that when you set a frame rate in Flash, it is treated as a target value, but the actual frame rate can vary wildly depending on how bogged down the CPU becomes. For example, you can set the fps to 60 but if you try to move and scale a 100,000x100,000 image around the stage, you better believe that frame rate is gonna drop significantly.


The GreenSock tweening platform is built to be based on time by default, so it will adjust its updates on-the-fly to ensure that the timing you defined in the tween is honored as closely as possible. By contrast, frames-based tweens (which is how MovieClip frames work in the Flash IDE) will prioritize ensuring that each and every frame gets played, meaning your animations can actually change their speeds drastically during playback (a 1-second tween might become 13 seconds long).


So the range you specified sounds about right although that number could drop lower if the Flash Player can't maintain the target frame rate. And that has nothing to do with TweenLite. Typically the cause of slowdowns is heavy loads in graphics rendering.

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.