Jump to content
Search Community

addCallback clobbering timeline when applied with label

adventmedia test
Moderator Tag

Recommended Posts

Evidently I don't understand how labels and/or addCallback are supposed to work…

 

Here's a simple bit of code:

 

_timeline = new TimelineMax();

_timeline.addLabel("ending", 15);

_timeline.addCallback(ending, "ending");

_timeline.appendMultiple([TweenLite.from(mc.common, 1, {alpha:0}), TweenLite.from(mc.instructions_1, 1, {alpha:0})], 1);

_timeline.appendMultiple([TweenLite.from(mc.instructions_2, 1, {alpha:0}), TweenLite.to(mc.instructions_1, 1, {alpha:0})], 5);

_timeline.appendMultiple([TweenLite.from(mc.instructions_3, 1, {alpha:0}), TweenLite.to(mc.instructions_2, 1, {alpha:0})], 5);

 

(and yes, there is a function ending())

 

When I run, nothing happens.

But if I move the addCallback statement to the end, everything works fine.

Isn't the callback supposed to be fired at the point in the timeline defined by "ending" (at 15 seconds)?

Or am I just not getting it?

 

And yes, I could solve the problem in this simple example just by moving the statement to the end, but I want to use this with subclasses where additional elements are added to the timeline in super() statements.

(same problem in v11 and v12)

Link to comment
Share on other sites

Hmm...I'd really like to see this in action. I tried copying your code and it worked perfectly for me - can you post a simple FLA that we can publish on our end that clearly demonstrates the issue? No need to post your production files - just create a super simple isolated FLA with only the necessary code to reproduce the issue. And please make sure you're using the latest GreenSock files (I don't recall any bugs that would affect what you're talking about though). I'm really curious to see an example.

Link to comment
Share on other sites

Ok, I was wrong, it was indeed my misunderstanding. I thought that events attached to labels would be independent of the accumulation of time in the timeline by appends. In other words, I thought that the first "appendMultiple" would be at the 1 second point , not 1 second after the callback at "end" (15 sec). In other words, I thought that, since adding a label does not move the index forward, any events attached to that label would not move the index forward either.

So, while according to your intended behaviour the sample does work, I thought that since nothing happened within the first 5-10 seconds, that it was not working as I expected.

I hope this is clear!

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