Jump to content
Search Community

Tweens while timeline is paused

rob_v_5712 test
Moderator Tag

Recommended Posts

I have a situation where there are several MCs on a timeline that get tweens applied to them.

I then pause the timeline and based on user interaction , some of the MCs that have been tweened on the timeline get tweened again.

once I unpause the timeline, it seems any MC that got tweened while it was paused, goes back to the state it was before, when I paused the timeline.

 

forexample:

myTimeline.add("step_1",10)
.to(graphic_1,1,{alpha:1,tint:0xE37034},"step_1")
.to(graphic_1a,1,{alpha:1},"step_1")
.to(graphic_2,1,{alpha:1,tint:0xE37034},"step_1")
.to(graphic_2a,1,{alpha:1},"step_1")
.call(myTimeline.pause,[],20)
.to(graphic_1,1,{x:100},30);




graphic_1.addEventListener(MouseEvent.CLICK, buttonClick1);
graphic_2.addEventListener(MouseEvent.CLICK, buttonClick2);


function buttonClick1(evt:MouseEvent):void
{
TweenLite.to(graphic_1,1,{tint:0x003460});
TweenLite.to(graphic_1a,1,{scaleX:5,scaleY:5,alpha:0});
}
 
function buttonClick2(evt:MouseEvent):void

{
TweenLite.to(graphic_2,1,{tint:0x003460});
TweenLite.to(graphic_2a,1,{scaleX:5,scaleY:5,alpha:0});

myTimeline.resume();
}
 

 

In this situation - the graphic_1 & 2 are orange and graphic_1a & 2a appear using the timeline, the timeline pauses, the user clicks the grahic_1 and it turns blue and graphic_1a scales and disappears

When graph_2 is clicked - it turns blue, and 2_a scales and disappears & the timeline resumes.

however - when it resumes, the graphic_1 is orange again, and graphic_1a is visable, (odd thing is it is scaled X & Y to 5)

 

(graphic_2 is blue, and 2_a scales out and disappears as expected)

 

Can someone shed some light on why this is happening?  

 

Thanks

 

 

 

 
 
 
 
 
 
 
Link to comment
Share on other sites

This is expected behaviour for the engine, hopefully I can explain it well enough so you can see why.

 

At it's core, all a tween really does is progressively set the value of a property between a start value and an end value. In the case of creating a .to() tween, you define the end value, and the start value is determined to be the current value at the time the tween starts.

 

Once a tween has recorded its start and end values they won't change; they're "locked in", and the tween is oblivious to any further changes you make externally to that property (well, overwrite comes into play when there are two active tweens of the same property, but that's avoided here by pausing the timeline).

 

If you want to modify the recorded start/end values of an already started tween, you can invalidate() it (i.e. for a .to() tween, the start value will be recorded again). You can invalidate a timeline too, which invalidates all of its child tweens.

 

Try

myTimeline.invalidate().resume();
  • Like 2
Link to comment
Share on other sites

I would agree with Jamie's initial assessment of the reason, although perhaps the solution needs tweaking. Frankly, I had a very difficult time following the description. It would really help if you could provide a very simple fla that clearly illustrates the issue with as little code and assets as necessary.

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