Jump to content
Search Community

Timeline Pausing/Resuming Issue

Nejuf test
Moderator Tag

Recommended Posts

I'm pausing timelines with pause() and resuming them with resume(). However, is as if the timeline is dragged out when it resumes, and labels no longer line up with the tweens contained in the timeline. I've traced most of the properties, and the only ones that seem to be different are duration and totalDuration which are increased by the amount of time spent while the timeline was paused. The startTime does not change.

 

Is this behavior normal? How can I make it so that my tweens and timelines are the right length and the labels line up after pausing and resuming? At the same time, I'm also calling TweenMax.pauseAll() and TweenMax.resumeAll(), could this be affecting the timelines(I did not give them any parent)?

 

I'm using AS3 version 1.64 of the Tweening Platform v11.

 

Thanks for any help.

Link to comment
Share on other sites

TweenMax.pauseAll() could change the duration of a timeline, yes. Let me explain...

 

Imagine 3 back-to-back 1-second tweens in a timeline. totalDuration = 3 seconds. Then, let's say you pause() all of the tweens for 2 seconds. During that 2 seconds, the timeline is still going (assuming you didn't pause() the timeline). When you resume the tweens, it drops them back into place on the timeline, but 2 seconds later than they were originally because that's where the playhead is now. Therefore, the totalDuration is now 5 seconds (there's a 2 second gap at the beginning of the timeline now, but that still counts toward the duration).

 

That's all expected behavior, and I can't think of any more logical way to handle it internally. However, there are three things I'd offer that might make things a lot easier:

  1. Why not just pause() the timeline? That effectively pauses all of its child tweens too. Much easier to control that trying to pause all the individual tweens.
  2. In v12, TweenMax.pauseAll() has a parameter that allows you to specify if you want timelines paused also. So you could call TweenMax.pauseAll(true, true, true);
    http://api.greensock....html#pauseAll()
  3. Another really interesting thing in v12 that could be useful here is the TimelineLite.exportRoot() method which basically takes all the tweens and timelines that are currently active (on the root timeline) and wraps them in a TimelineLite instance and spits it back at you so that you can control everything very easily, like setting its timeScale to 0.5 to slow everything down or pause() or whatever.
    http://api.greensock...tml#exportRoot()

Does that clear things up?

  • Like 1
Link to comment
Share on other sites

Thank you very much for the help and explanation.

 

I think I am calling pause() for the timelines.

for each(var tl:TimelineLite in timelines)
  {
   if (tl != null)
   {
 tl.pause();
   }
  }
TweenMax.pauseAll();

The reason I also call TweenMax is because there are assorted tweens and delayed calls that are not added to any timelines.

 

I'm not sure what I did to cause this change, something with child timelines or tweens I think, but I found that if I do the pause before the timeline begins, it's duration increases, but if I do it during the timeline, the start time increases, but not the duration. By increasing the startTime of timelines that haven't begun yet, whenever I finish a pause, things seem to be lined up once the timeline starts. Though, now I have problems with other timelines. I'm thinking it has to do with TweenMax.resumeAll and the fact that I have independent tweens and tweens on timelines. If you could answer a couple questions, I think I can work out a solution.

 

Does TweenMax.pauseAll/resumeAll change the pause state of all tweens regardless of the pause state or delay of any parent timelines?

What are the differences between active and paused for timelines?

What is the effect of pausing/resuming on tweens or timelines that are delayed and haven't started yet?

 

Thanks again.

Link to comment
Share on other sites

Does TweenMax.pauseAll/resumeAll change the pause state of all tweens regardless of the pause state or delay of any parent timelines?

Yes.

 

What are the differences between active and paused for timelines?

Pretty much the same as tweens - if it's active, that means the playhead can move across it and cause it to render. If it's paused, it won't render and it suspends itself until you resume. Think of everything as though it's on a root timeline (because that's exactly what happens). Even other timelines get placed on the root timeline (like nested MovieClips inside MovieClips in the Flash IDE). By default, all tweens are on the root, but you can put them into a timeline - either way, there's ALWAYS a parent timeline (except for the root of course). If you pause() a tween or timeline, it just tells its parent not to render it (the internal playhead remains frozen while that particular tween/timeline is paused). When you resume(), it literally moves the tween in its parent so that the internal playhead lines up with the parent timeline's playhead so that everything plays back perfectly smoothly.

 

What is the effect of pausing/resuming on tweens or timelines that are delayed and haven't started yet?

Pretty much the same thing - they're suspended from the rendering queue and the playhead is locked wherever it is (which in this case is at the beginning, or time:0).

Link to comment
Share on other sites

Thank you very much. With that information, I think I was able to fix everything. I abandoned using TweenMax.pauseAll/resumeAll and now keep a vector reference to floating tweens, pausing them as needed, similar to how I handle timelines. I also had the mistake of only pausing timelines if they were active and not paused, whereas they should be paused even if they're not active yet.

 

:-P

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