Jump to content
Search Community

[bug] TimelineMax and pausing

Alexx999 test
Moderator Tag

Recommended Posts

I post it here as I was unable to find any links to bugtracker

consider creating some timeline and appending tweens, like:

		var timelineTween:TimelineMax = new TimelineMax({repeat:-1});

		timelineTween.append(new TweenMax(this, GameSettings.GAME_OBJECTS_OSCILLATION_TIME / 2, {x:destX, y:destY, ease:Linear.easeNone}));
		timelineTween.append(new TweenMax(this, GameSettings.GAME_OBJECTS_OSCILLATION_TIME / 2, {x:this.x, y:this.y, ease:Linear.easeNone}));

 

then implement pausing in game:

 

	TweenMax.pauseAll();

 

what is expected to happen: timelines are paused too (as they don`t have pauseAll function)

what happens: everything is paused, but after resume timelines are broken (they play to end, stop for a while, and then resume)

 

possible workaround: I added following to TimelineMax class


	private static var timelines:Vector. = new Vector.;
	public static function pauseAll():void 
	{
		for each (var t:TimelineMax in timelines)
		{
			t.pause();
		}
	}
	public static function resumeAll():void 
	{
		for each (var t:TimelineMax in timelines)
		{
			t.resume();
		}
	}

Link to comment
Share on other sites

Hello,

 

I have a few things which might help you understand why certain things are happening.

 

1: as you have experienced pausing child tweens of a TimlineLite/Max does not affect the paused state of their parent timelines. it works the same way with nested movie clips. if you pause a child movie clip, the parent doesn't care and will continue playing. Although, pausing a TimelineLite/Max will pause all of its child tweens.

 

2: less obvious, pauseAll/resumeAll predate TimelineLite/Max: check out GreenSock's explanation from a previous thread:

 

As for the pauseAll() and resumeAll() ... those are legacy functions that were primarily for apps that used straight tweens to do everything rather than organizing them in TimelineLite or TimelineMax instances. Have you tried setting TweenMax.globalTimeScale to 0 to get the "pause" effect and then back to 1 to resume? I suspect that might work better for you. Or just organize your tweens into a root TimelineLite instance that you can pause() and resume() whenever you want.

from: viewtopic.php?f=1&t=6176&p=23833&hilit=pauseAll#p23833

 

3: To me your solution looks pretty cool. I'm sure GreenSock will weigh in on why or why not something like this should be added to the official API. It looks like it could be pretty handy, but also it would be pretty easy for a developer to code into their app when needed by just creating their own Array/Vector of timelines that they would like to pause as a group as you have.

 

Hope this helps a little. Thanks for your suggestion.

Link to comment
Share on other sites

well, you see, I'm currently not developing a new game from scratch, but continued work on what's left from previous developer.

situation is following: game relies heavily on tweens, but usage is TERRIBLY inconsistent (in some places there are just tweens, in other - timelines, different approaches used to solve same problems (two opposite tweens in timeline vs one "yoyo" tween))

full rewrite is not an option - so I have to work with that, and in this situation stuff that I reported is pretty bad

Link to comment
Share on other sites

Carl is correct - TweenMax.pauseAll()/resumeAll() predate the timeline classes. And technically you can accomplish what you're after by keeping track of your own timelines (in an array or Vector) or putting all your tweens into a master TimelineLite, but I do intend to integrate the functionality into TweenMax's pauseAll()/resumeAll() in the upcoming major version release of the tweening platform (v12). Keep an eye on greensock.com for the announcement (it won't be for at least another month because there is a lot of effort going into this next version and it will include a Javascript version too). Stand by...

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