Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

TimelineMax Delay Overwite

Recommended Posts

Alright, So I have a issue that I need some assistance on. I have a TimelineMax setup where I set multiple tweens together based on some XML info. Some of these tweens involve a video that plays and the delay of the Timeline tween is based on the duration of the video. Everything works great. I have now been tasked to have a skip feature and have run into said issue.


I was able to kill the specific target inside my timeline tween, with help from a tidbit of info from Jack earlier (which worked like a charm), and fake-the-funk when it comes to the video playback, but what I don't see happening is the overwriting of the timelline max's delay. Is there a way to rest this delay of kill it so that the next object can begin tweening immediately after

Link to comment
Share on other sites

When you say "overwrite the delay", are you saying you want all the tweens/timelines the are positioned AFTER a particular tween's startTime to be picked up and moved forward in the timeline (adjusting when they are scheduled to begin)? So if you have a tween that begins at exactly 2 seconds into the timeline and it has a duration of 5 and then 10 other tweens are scheduled to begin after that (their startTimes are 7 seconds into the timeline), you want to shift those 10 up so that they start at 2 instead of 7?


If so, sure. You can either loop through and manually adjust their startTime or use the shiftChildren() method like:


myTimeline.shiftChildren(-5, true, 2); //shifts all of the children with startTimes at 2 or later by -5 seconds.

Link to comment
Share on other sites

Let me clear something up. I'm looking to reset/end/kill the offset that is created when I append a particular tween object when I force that same object to complete/kill. Does this make sense? Will shiftChildren account for the offset?

Link to comment
Share on other sites

reset (restart), end (complete), and kill are all completely distinct things so I can't just give you one answer that covers all of those scenarios.


Let me give you a scenario and you tell me how you'd want it to handle things:


timeline.insert( new TweenLite(mc1, 5, {x:100}), 0);
timeline.insert( new TweenLite(mc1, 5, {y:100}), 2);
timeline.insert( new TweenLite(mc1, 5, {alpha:0}), 7);
timeline.insert( new TweenLite(mc2, 5, {x:100}), 5);


Now let's say I kill() the second tween - in your scenario, what happens to the other 3? Notice that 3 tweens are for mc1 and 1 tween is for mc2. Also notice that 1 tween starts before (and overlaps with) the tween that is being killed. Would all tweens shave 2 seconds (the killed tween's delay) off their startTime? Just the ones after the killed one? Only tweens of mc1?


You can pretty much accomplish anything you want with the methods that are exposed in TimelineLite/Max. Either get all the children and loop through, changing the startTime of whichever tweens meet your criteria or use the shiftChildren() method which covers most scenarios like this.

Link to comment
Share on other sites

Thanks again for being for patient and helping out with this.


So I'm trying to account for my situation in your example - If I kill() the second tween which has an offset of 2 seconds, I want to immediately go to the third tween without having to wait the remainder of that offset. In essence, just dropping down to the next tween as if the second tween never happened and continuing on from there.


Now, I have my tweens complete() then kill() immediately, and that works, but it seems to still keep the offset - So i'm waiting on the offset to finish before i see the next tween.


So, in my example here's what would be happening, first I wouldn't separate the tweens for one object. I have it where the each tween sequentially takes care of a specific object, like so:


timeline.append(TweenLite.to(DP[i], SPEED, {autoAlpha:100, _xscale:100, _yscale:100, ease:Back.easeOut, onStart:loadVideoNow, onStartParams:[DP[i], DP[i].videoName]}));
timeline.append(TweenLite.to(aContainer.aHolder, SPEED, {_x:-(DP[i]._x), _y:-(DP[i]._y), ease:Cubic.easeOut}),-SPEED*1.2);
timeline.append(TweenLite.to(DP[i].dBoxArrow, SPEED/2, {_y:DP[i].dBoxArrow.ENDPOSY, _x:DP[i].dBoxArrow.ENDPOSX, _yscale:100, _xscale:100, ease:Strong.easeOut, onComplete:killAudioEQ, onCompleteParams:[DP[i]]}),int(DP[i].videoDura)+int(DP[i].holdOVRide));


(Where DP is and array of mc's i'm looping through.) So a box appears, centers to the stage, and there's an arrow that points to the next box. This animation is held the length of the video (which i put in as the offset of int(DP.videoDura)+int(DP.holdOVRide) in the example above, where videoDura is just a number var stored in a movieclip). Man that's a mouth full!


This system works fine. Now i'm trying to end the video, after it starts playing, and continue on to the next tween so i have a function that does the following:

boton.onRelease = function() {
var tweens:Array = timeline.getChildren();
for (var i:Number = 0; i		if (tweens[i].target == CURVIDCONT) {
		var mc:MovieClip = tweens[i].target;






var timeShift:Number = CURVIDCONT.videoDura - CURVIDCONT.nStream.time;

timeline.shiftChildren(timeShift, true , 0);


Is this confusing or what? Any insight would be greatly appreciated!

Link to comment
Share on other sites

from what i'm getting of your situation (and i could be wrong)... i think the solution could be much simpler.


I would suggest taking the use of the duration of the video as a delay / offset out of the equation completely.


add an onComplete callback to the arrow tween that does a timeline.pause(). Or whenever it is that the video starts playing


when the video is done playing fire an event that will trigger the timeline to resume or play.

when the user clicks "skip" do the same.


it appears you are already using an onComplete and have a solid knowledge of greensocky stuff so it should be pretty easy for you to whip up.


its my impression that when the video is playing, the timeline isn't tweening any other objects so pausing it shouldn't hurt.

when you resume... everything just tweens out as scheduled.




hope this helps




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.