Jump to content
Search Community

Is there a way to get the state of a timelinelite?

marcfolio test
Moderator Tag

Recommended Posts

You can find out if the instance is paused by using the "paused()" method (it'll return a boolean). However, keep in mind that if you're nesting things, that property doesn't always correlate to what the tween APPEARS to be doing. For example, let's say you put a tween into a timeline that's paused. The tween's "paused" state was never set to true. But if the parent timeline is paused, that tween won't play of course. It'll APPEAR paused, but its paused property is false. I realize that might sound like a bug, but it's not - "paused" is like a flag that tells the engine to either allow that instance to play or not. If it's paused, it WILL NOT PLAY.

 

If the "paused()" property always looked up the hierarchy and took into account all its ancestors' "paused" state, you could run into an equally confusing situation where you create a tween, put it into a timeline and then check its "paused()" state only to discover that it's true and you never set it to true. Or unpausing the timeline changes the property of the child tween. Arguments could be made on either side that each behavior is a "bug" but it's logically impossible to have it act both ways. Plus there are performance considerations to take into account (the current behavior is fastest).

 

You could, of course, iterate up the chain yourself and discover if any ancestor is paused.

 

You can also check the "reversed()" property and you can check the "time()" or "totalTime()" to see if they equal "duration()" or "totalDuration()" which would be an indicator that they're done. All of the classes except TweenLite have a "progress" property that reports a value between 0 and 1 for their overall progress, so you can use that too. (For TweenLite, you can easily calculate progress with myTween.time() / myTween.duration()).

 

Hope that helps. It should be entirely possible to get the data you want.

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