Jump to content
GreenSock

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

Simple Timeline sequencing question

Recommended Posts

This is another no-brainer that's puzzling me. If someone could show me the error of my ways I'd be grateful. In this code

 

 

 
tl.to(startButton,0.25,{autoAlpha:1}, "+=1");
tl.addCallback(waitForStartButtonPush,"+=0.01");
tl.to(startButton,0.25,{autoAlpha:0}, "+=.01");
 
 
where "tl" is a timelinemax appended to the main timeline and 'startButton' is a movieclip on stage, followed by

 

private function waitForStartButtonPush():void { _mainTimeline.pause(); startButton.addEventListener(MouseEvent.CLICK,startButtonClick,false,0,true);}

the issue I was having is that the startButton was only tweening partway to autoAlpha== 1. I solved this by putting the autoAlpha tween inside waitForStartButtonPush(), before I paused the main timeline, but I was unclear why it wasn't working the first way — why is the call to mainTImeline.pause getting called partway through the tween? It may be something in the way I've ordered my timelines, but I wanted to know if there's a reason I'm missing in the way I'm timing things.

Link to comment
Share on other sites

I couldn't replicate this issue at all - could you post a very simple FLA that clearly demonstrates the issue so that we can publish on our end and see what's happening? 

Link to comment
Share on other sites

I tried it with a simple FLA at my end, it worked fine.  I will assume that it's a side-effect of something elsewhere in my code.  I suppose, though, since I was getting two different results, I wanted to check whether I was understanding the manner in which callbacks interact, in terms of timing and being placed at specific points in the timeline, with the tweens, etc.  As I understand it, although callbacks take up zero space in the timeline, if you try to sequence things with the placement param ("+=n"), things will be kept in sequence.  (Sorry if some of these are basic queries — I feel like I did when I was first learning German; it all makes sense in the end, but making sense of the grammar/API, and the exceptions -- finding the big picture -- takes a while)

Link to comment
Share on other sites

No problem at all. The forums are here for questions. 

 

Yes, you're correct - callbacks don't take up any time whatsoever, and you can sequence things as much as you want and things should work great. If you're adding callbacks on top of each other at the same time, they should run in the order you added them (or, if you're playing the timeline in reverse, they'd go in reverse order). Does that answer your question?

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