Jump to content

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

AS2: Position for .call() method of TimelineLite doesn't work.

Recommended Posts



If I call a function at the end of a timeline, position parameter doesn't work (neither absolute nor relative). Here's the code:

var startupTimeline:TimelineLite =  new TimelineLite();

startupTimeline.set (overlay, {_visible:false})
               .from (backdrop, 0.3, {_alpha:0, ease:Linear.easeNone})
               .staggerFrom ([picBox_1, text_1], 0.3, {_y:"+=10", ease:Cubic.easeOut}, 0.1)
               .staggerFrom ([picBox_1, text_1], 0.3, {_alpha:0, ease:Linear.easeNone}, 0.1, "-=0.4")
               .from ([arrowLeft, arrowRight], 0.3, {_y:"+=10", _alpha:0, ease:Cubic.easeOut}, "-=0.2")
               .staggerFrom ([chooseButton, logo], 0.3, {_y:"+=10", _alpha:0, ease:Cubic.easeOut}, 0.1, "-=0.2")
               .from (text_2, 0.3, {_y:"+=5", _alpha:0, ease:Cubic.easeOut}, "-=0.2")
               .from (text_18_plus, 0.3, {_alpha:0, ease:Linear.easeNone}, "-=0.2")
               .set (backdropOverlay, {_visible:true})
               .call (function():Void {switchPortraitsTimer = setInterval (switchPortraits, 2000);}, null, "-=1");
Link to comment
Share on other sites

Please make sure you are using the latest version of TweenLite.


in AS2 the call() method takes an additional scope parameter:


JavaScript and AS2 note: - Due to the way JavaScript and AS2 don't maintain scope (what "this" refers to, or the context) in function calls, it can be useful to define the scope specifically. Therefore, in the JavaScript and AS2 versions the 3rd parameter is scope, but that parameter is omitted in the AS3 version.


Here is a very basic test you can run:

import com.greensock.*;

var tl:TimelineLite = new TimelineLite();
tl.to(mc, 1, {_x:200})
  .call(trace, ["hello"], this, "+=1")
trace(TweenLite.version); //12.1.5
Link to comment
Share on other sites

That solved the problem. Thank you!

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.