Jump to content
Search Community

Timeline question

joakimhoegset test
Moderator Tag

Recommended Posts

Hi I have been trying to get my head around a problem on a timeline animation that is scrubbable on the timeline. I want to put a conditional statement if there is a detection of an object and if so then make an alternative tween. If not then just tween as normal. My idea was to insert a label after the conditional tween so that it will play the whole tween if it does detect an object and if it doesn't then jump to the label and skip the tween it should do only when detecting an object.

My question was this. Is there a way to insert a label and on complete call a variable that changes depending on what happens onInit?

 

Thanx for any input.

 

Joakim

Link to comment
Share on other sites

Sure, I assume it'd look kinda like this (untested):

 

timeline.append( new TweenLite(mc, 1, {x:100, onStart:checkCondition}) ); //your conditional tween
timeline.addLabel("myLabel", timeline.duration);
function checkCondition():void {
   if (...whatever...) {
       timeline.gotoAndPlay("myLabel");
   }
}

 

Or you could addCallback() in TimelineMax instead of using an onStart in the tween itself.

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