Jump to content
Search Community

Timelinelite replaying TweenLite Errors

sorciereus test
Moderator Tag

Recommended Posts

Hi there, I have the following code on an animation:

 

import flash.display.MovieClip;
import flash.events.MouseEvent;
import com.greensock.*;
import com.greensock.easing.*;
import flash.ui.Mouse;
import com.greensock.plugins.TweenPlugin; 
import com.greensock.plugins.BlurFilterPlugin;
TweenPlugin.activate([BlurFilterPlugin]);

var tl:TimelineLite = new TimelineLite();

tl.insert(TweenLite.from(who_mc, .25, {x:420, blurFilter:{blurX:10}, ease:Quad.easeOut}));
tl.insert(TweenLite.to(who_mc, 1, {x:140, delay:.25}));
tl.insert(TweenLite.to(who_mc, .5, {x:-126, ease:Quad.easeIn, alpha:0, delay:1.20}));
tl.insert(TweenLite.to(black_mc, .5, {x:-161, ease:Quad.easeOut, delay:1.5}));
tl.insert(TweenLite.from(grab_mc, .5, {x:-120, blurFilter:{blurX:10}, ease:Quad.easeOut, delay:2}));
tl.insert(TweenLite.to(grab_mc, 1, {x:168, delay:2.45}));
tl.insert(TweenLite.from(by_mc, 1, {x:437, blurFilter:{blurX:10}, ease:Quad.easeOut, delay:2}));
tl.insert(TweenLite.to(by_mc, 1, {x:140, delay:2.45}));
tl.insert(TweenLite.to(by_mc, .5, {x:-121, delay:3.4, ease:Quad.easeIn, alpha:0}));
tl.insert(TweenLite.to(grab_mc, .5, {x:423, delay:3.4, ease:Quad.easeIn, alpha:0}));
tl.insert(TweenLite.to(img1_mc, .5, {y:-126,  delay:3.9}));
tl.insert(TweenLite.from(img2_mc, .5, {y:384,  delay:3.9}));
tl.insert(TweenLite.from(white_mc, .5, {x:-95, delay:4.4}));
tl.insert(TweenLite.from(labor_mc, .25, {x:-72, ease:Quad.easeOut, delay:4.9}));
tl.insert(TweenLite.from(sale_mc, .25, {x:-72, ease:Quad.easeOut, delay:5}));
tl.insert(TweenLite.from(clearance_mc, .25, {x:-72, ease:Quad.easeOut, delay:5.1}));
tl.insert(TweenLite.from(rectangle_mc, .25, {x:-93, ease:Quad.easeOut, delay:5.2}));
tl.insert(TweenLite.from(percent_mc, .25, {x:-93, ease:Quad.easeOut, delay:5.3}));
tl.insert(TweenLite.from(save_mc, .25, {x:-93, ease:Quad.easeOut, delay:5.4}));
tl.insert(TweenLite.from(save_btn, .25, {x:-93, ease:Quad.easeOut, delay:5.5}));
tl.insert(TweenLite.from(blur_mc, .5, {alpha:0, delay:4.9}));


function replayHover(e:MouseEvent):void{
TweenLite.to(replay_click, .5, {rotation:360});
}

function clickReplay(e:MouseEvent):void{
tl.restart();
}

replay_click.addEventListener(MouseEvent.CLICK, clickReplay);
replay_click.addEventListener(MouseEvent.MOUSE_OVER, replayHover);

replay_click.buttonMode = true;

 I'm using timelinelite on a replay button to replay all the animation - it works fine, and has always worked fine in the past (until recently) however it's not resetting the x value in the following two lines of code:

tl.insert(TweenLite.from(grab_mc, .5, {x:-120, blurFilter:{blurX:10}, ease:Quad.easeOut, delay:2}));
tl.insert(TweenLite.from(by_mc, 1, {x:437, blurFilter:{blurX:10}, ease:Quad.easeOut, delay:2}));

The rest of the code is resetting perfectly. Any suggestions? 

 

 

Link to comment
Share on other sites

Its hard to look at all that code and really know for sure, but it looks like it is an overwrite issue.

 

Both those tweens appear to overlap with other tweens on the same properties of the same target.

 

For instance look at both of these

TweenLite.from(grab_mc, .5, {x:-120, blurFilter:{blurX:10}, ease:Quad.easeOut, delay:2})
TweenLite.to(grab_mc, 1, {x:168, delay:2.45})

The first tween starts at 2 seconds and has a duration of .5 meaning it will end at 2.5 seconds.

The second tween has a delay of 2.45 seconds which means both tweens are fighting for control over the x value at the same time. 

 

When there is a conflict like this, the first tween will be killed due to the default overwrite mode of auto (kills all conflicting tweens on the same properties of the same object). Once that first tween gets killed it is gone, removed from the timeline. That is why it didn't play again on repeat.

 

A few solutions. Start the second tween with a longer delay. Or set overwrite:"none" on the second tween.

TweenLite.to(grab_mc, 1, {x:168, delay:2.45, overwrite:"none"});

it seems that a similar scheduling conflict occurs with by_mc so be sure to set overwrite:"none" on those tweens too.

 

If this doesn't solve the problem please provide a simplified fla with ONLY enough code to replicate the problem.

 

Thanks!

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