Jump to content
Search Community

Tracing the current position of tween

Arod2013 test
Moderator Tag

Recommended Posts

Hey everyone, I've searched but have come up pretty much empty handed.... Is there a way you can trace the current position of a tween object?

 

I'm messing around in Flash CS6 and using some Timers and Tweens and I would like to see how accurate I can get them, but stuck on tracing the object's current position.

Link to comment
Share on other sites

The tweening engine just sets the normal properties (albeit many times per second), so you can just access those directly. You don't have to go through the tweening engine somehow. For example:

TweenLite.to(mc, 2, {x:200, y:300});
//you can trace() the position anytime like this:
trace(mc.x + ", " + mc.y);

Or if you want to constantly trace them each time they update:

TweenLite.to(mc, 2, {x:200, y:300, onUpdate:report});
function report():void {
    trace(mc.x + ", " + mc.y);
}

If, however, you're asking how to find out how far along a tween is (progress-wise), you can get its time() whenever you want. The time() method returns the current time, like the playhead position of the tween/timeline.

 

Does that answer your question?

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