Jump to content


TimelineMax AS2 onComplete and pause don't work

Recommended Posts

Hello, i need TimelineMax in a AS2 project, but there is a problem:


The onComplete-Funktion fires directly in the first second not on end of the tweening queue.

And i could not pause the sequence on Frame 45.


Here my code:


import com.greensock.*; 
import com.greensock.easing.*;

var calDelay:Number = 2;

var myTimeline:TimelineMax = new TimelineMax(onComplet:step1complete);

myTimeline.insert(new TweenMax.from(bg1, 1, {_alpha:0, blurFilter:{blurX:20}, delay:0.5}));
myTimeline.append(new TweenMax.from(cal_januar, 0.8, {_alpha:0, _x:750, ease:Back.easeOut, delay:calDelay + 0.1}));
myTimeline.append(new TweenMax.from(cal_januar_mask, 0.8, {_x:750, ease:Back.easeOut, delay:calDelay + 0.1}));
myTimeline.append(new TweenMax.from(cal_februar, 0.8, {_alpha:0, _x:750, ease:Back.easeOut, delay:calDelay + 0.2}));
myTimeline.append(new TweenMax.from(cal_februar_mask, 0.8, {_x:750, ease:Back.easeOut, delay:calDelay + 0.2}));
myTimeline.append(new TweenMax.from(cal_march, 0.8, {_alpha:0, _x:750, ease:Back.easeOut, delay:calDelay + 0.3}));
myTimeline.append(new TweenMax.from(cal_march_mask, 0.8, {_x:750, ease:Back.easeOut, delay:calDelay + 0.3}));
myTimeline.append(new TweenMax.from(cal_april, 0.8, {_alpha:0, _x:750, ease:Back.easeOut, delay:calDelay + 0.4}));
myTimeline.append(new TweenMax.from(cal_april_mask, 0.8, {_x:750, ease:Back.easeOut, delay:calDelay + 0.4}));

function step1complete():Void


on Frame 45 i have this code:



but nothing happend.

Please help me :-)

Link to comment
Share on other sites

your syntax is wrong.

also a suggestion, as I see it mask and masked objects are moved the same, so a good idea maybe would be to put those into a container, push the container into an array and then animate that.

Try this


// SETUP ===============================
// make an array
var arrMonth:Array = new Array();

// Do something like this to all your mask/masked pairs
var monthCon:MovieClip = this.createEmptyMovieClip("monthCon",this.getNextHighestDepth());

// push container into array

// ANIMATION ===============================
import com.greensock.*; 
import com.greensock.easing.*;

TweenMax.from(bg1, 1, {_alpha:0, blurFilter:{blurX:20}, delay:0.5}));

var myTimeline:TimelineMax = new TimelineMax({onComplete:step1complete});
myTimeline.insertMultiple( TweenMax.allFrom(arrMonth, 0.8, {_alpha:0, _x:750,  ease:Back.easeOut}, 0.1), 0.0); // objects, time, { props }, stagger (delay between each object in array), delay (before timelinemax starts)

function step1complete():Void

Link to comment
Share on other sites

Hello Hippiesvin,


thx a lot for your answer.

But it i can't use your solution.

I will have a global button to pause and resume all framebased AND greensock-based animations.

Thats why i insert all Animations into TimlineLite to pause all current availible animations.


My problem: If i press the pause button to pause all animations, nothing happend.

(I think there is a global Problem in my skript because the onComplete-Funktion starts at the beginning of my Tween)


I hope you understand my bad english :-)

Link to comment
Share on other sites

Hippiesvin was correct - you mistyped "onComplete":


BAD: onComplet:step1complete

GOOD: onComplete:step1complete


I don't see any reason why your step1complete function would be called immediately, but maybe you have some other code that's causing problems elsewhere. Difficult to troubleshoot without seeing an FLA that demonstrates the problem. Feel free to post one, but please remove ALL unnecessary code and only use the absolutely essential code to reproduce the issue. No need to post your production files.


Also, it sounds like you may have a scope issue (which is common in AS2). Try defining the onCompleteScope, like this:

var myTimeline:TimelineMax = new TimelineMax(onComplete:step1complete, onCompleteScope:this);

Link to comment
Share on other sites

Good morning :-)


At first: Thx a lot for your help. As attachment, there is an example file.

You will see the onComplete function starts on Tween-Start AND the pause() func after some Frames don't work.


To info: In the real project i would not use the pause() func in this type. There will be a btn and this btn will pause() the framebased anis and the grennsockanis.


Thx a lot for your help I'm very interessted in your comments.

Kind regards HM

Link to comment
Share on other sites

You were using the wrong syntax so it was causing the Flash Player to choke.


BAD: myTimeline.append( new TweenMax.from(...) );

GOOD: myTimeline.append( TweenMax.from(...) );


You either use "new TweenLite(...)" or you use "TweenLite.from(...)" or "TweenLite.to(...)". You don't mix them with "new TweenLite.from()"

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.