Jump to content
Search Community

timelineMax Play/Reverse w/ Pausing issue

Ribs test
Moderator Tag

Recommended Posts

Hi,

I have a left and right arrow that play/reverse between 5 (have only 3 built so far) scenes.

 

I inserted pauses:

 

timeline.addCallback(Pause, boxDur*4); // 1st pause

timeline.addCallback(Pause, boxDur*5); // 2nd pause

 

with a timeline.pause(); callBack function where needed.

 

When you click rArrow (on stage), it plays to the next pause. When you click lArrow (on stage), it reverses to the previous pause -- pretty simple right?

Well, sometimes, only sometimes, does the play and reverse functions fail to work so I have to click(reverse) all the way back to the beginning of the timeline instance to get it to "reset" and actually play/reverse.

 

I'm tracing the currentProgress of the timeline instance and getting an output of inconsistent numbers (scenes 1 to 3 and back to 1):

0

0.8360000000000005

1

0.7919999999999998

0

0.8360000000000003

1

0.7919999999999998

 

Here is my timeline code:

 

//***************** SCENE 2 *************************************************************

timeline.insert(TweenMax.from(warPraCopy, dur, {x:424.8, y:617.0}));
timeline.insert(TweenMax.from(box1, dur, {x:464.1, y:469.9}));
timeline.insertMultiple([TweenMax.from(box2, boxDur, {x:400, alpha:0, delay:boxDur}),
					 TweenMax.from(box3, boxDur, {x:400, alpha:0, delay:boxDur*2}),
                        TweenMax.from(box4, boxDur, {x:400, alpha:0, delay:boxDur*3})]);

//***************** SCENE 3 *************************************************************

timeline.appendMultiple([TweenMax.to(box1, boxDur, {x:74.7}),
					 TweenMax.to(box2, boxDur, {x:336.8, y:383.1}),
					 TweenMax.to(box3, boxDur, {x:551.3, y:385.1, alpha:.2}),
                        TweenMax.to(box4, boxDur, {x:733.5, y:397.7, alpha:.2})]);

 

Here are my MOUSE_DOWN callBack functions for each arrow:

 

function skipForw (e:MouseEvent) {
currFrame++;
if (currFrame <=5) {
	timeline.play();
	lArrow.gotoAndStop(currFrame);
	rArrow.gotoAndStop(currFrame);
	if (currFrame > 1)
		lArrow.visible = true;
}
else
	currFrame = 5;
trace(timeline.currentProgress);
}

function skipBack (e:MouseEvent) {
currFrame--;
if (currFrame >=1) {
	timeline.reverse();
	lArrow.gotoAndStop(currFrame);
	rArrow.gotoAndStop(currFrame);
	if (currFrame == 1)
		lArrow.visible = false;
}
else
	currFrame = 1;
trace(timeline.currentProgress);
}

 

Can you please explain if I'm doing anything wrong? Doing this for work and would be a HUGE help for future projects. BTW I'm a BIG fan of your work and am extremely appreciative of your contributions to the Flash community.

 

Thanks!

Ribs

Link to comment
Share on other sites

hmmm, I don't really see why that would happen unless your Pause function also contains some code that makes the timeline resume playing after a set amount of time.

 

I would suggest putting a trace("paused " at timeline.currentTime); into your Pause function just to verify that it is being called at the right time.

 

you could try an alternate approach of adding labels at each section

 

timeline.addLabel("scene1", timeline.duration);

timeline.insert(TweenMax.from(warPraCopy, dur, {x:424.8, y:617.0}));
timeline.insert(TweenMax.from(box1, dur, {x:464.1, y:469.9}));

timeline.addLabel("scene2", timeline.duration);

timeline.insert(TweenMax.from(warPraCopy, dur, {x:424.8, y:617.0}));
timeline.insert(TweenMax.from(box2, dur, {x:464.1, y:469.9}));

timeline.addLabel("scene3", timeline.duration);

timeline.insert(TweenMax.from(warPraCopy, dur, {x:424.8, y:617.0}));
timeline.insert(TweenMax.from(box3, dur, {x:464.1, y:469.9}));

 

and then your arrows can just tweenTo() the next scene like:

 

curFrame++
timeline.tweenTo("scene" + curFrame");

Link to comment
Share on other sites

Also, this is the output from your trace method going back and forth from scene 1 and 2:

0

paused at: 0.8359999999999999

0.5971428571428571

paused at: 0.7959999999999998

0

paused at: 0.8360000000000003

0.5971428571428574

paused at: 0.7919999999999998

0

paused at: 0.8319999999999972

Link to comment
Share on other sites

from those numbers I'm guessing it works ok going from 1 to 2 and back as the numbers look consistent. If you want to simplify your file and upload it as cs5, I'll take a look.

 

also it appears that a user could click 3 times really fast and the value of curFrame could get out of whack... maybe that's the problem.

Link to comment
Share on other sites

Hey Carl,

Wanted to say thanks for your help and speedy responses. Definitely helped me out of this bind. I ended up using tweenTo. I hate to say this, but I'm inclined to believe there is some sort of bug with the timelineMax.reverse(); function in co-relation with .pause as used in addCallBack. I wonder what tweenTo is doing differently than .reverse.

 

Also, in response to programmers having issues with clicking to navigate through the tweens too fast before the tween is complete, tweenTo preforms perfectly. It just tweens to the current desired scene as you would think it ideally should. GO tweenTo!!! =D

 

Anyway, thanks again!

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