Jump to content
GreenSock

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

Use Inline Function with call()

Recommended Posts

Sometimes I need to execute code at a certain point in the timeline. The call() function works fine to call external functions. However, when the function isn't called more than once, an external function seems unnaccessary. Is there any way to execute an inline function?

 

This doesn't work:

myTimeline.call(function() {
  doThis();
  doThat();
  var myVar = new MovieClip();
  etc.
});
Link to comment
Share on other sites

Yes, the way you suggested seems to work just fine. 

import com.greensock.*;


var tl:TimelineLite = new TimelineLite();


tl.to(mc, 1, {x:200})
  .call(function(){
      trace("hello");
      showMessage("goodbye");
  });


function showMessage(message:String):void{
  trace(message);
}
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.
×