Jump to content

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

TimelineMax appending Tweens and onComplete

Recommended Posts



I am writing pretty simple game that utilizes MVC pattern. Model is calculating data stored in Array and dispatches events to View that tries to reproduce and visualize it. I wanted to implement View in the way that TimelineMax is handling the tweens by queing it up and play it at the certain point of time.


Here is the mainLoop from Model


public function mainLoop():void
  dispatchEvent(new Event(BoardModel.PLAY));    

the function applyBonus or fall just dispatches appropriate events to View. The listeners to this methods just create Tweens and are adding them to the TimelineMax using the append method. The problem is that each on this tweens has a its onComplete method. I want to make sure that not only twees are executed in correct order but also onComplete.


Currently I have:


applyBonus tween

fall tween

applyBonus onComplete

fall onComplete


I wish to have:


applyBonus tween

applyBonus onComplete

fall tween

fall onComplete



How can I achieve something like this?


Link to comment
Share on other sites



Its very hard to imagine that 3 tweens that are appended to a timeline are playing out of order, or that their onComplete callbacks aren't firing at the right time. Having tweens play in order is part of the core mechanics of the timeline classes, and we've never heard about something like this or seen it in our daily work.


The only way the second tween would fire its onComplete before the first tween is if it had a negative offset greater than it's length, like if you appended a 1 second tween -2 seconds from the end of the timeline.


The code that you have shown doesn't give a full picture of what is happening.


It would be very helpful to see


1) how / where the timeline is created

2) how each function is adding the tweens to the timeline.

3) I noticed your function is called mainLoop(), I assume its being called multiple times per second. Are you always adding your tweens to the same timeline? or new timelines? I ask because I wonder if you have overlapping timelines.


Can you provide a very simplified example that illustrates this behavior?

We'd like to help you solve the problem.

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.