Jump to content
Search Community

label array?

LEL test
Moderator Tag

Recommended Posts

Your wish is my command, Lisa :)

 

I just updated the platform and added a "currentLabel" property to TimelineMax as well as getLabelAfter() and getLabelBefore() methods. It also has a getLabelTime() method. So to get the next label after 2-seconds for example, you'd do myTimeline.getLabelAfter(2);

 

http://blog.greensock.com/v11beta/

 

Enjoy!

Link to comment
Share on other sites

Thank yoU!!!

 

I updated my "com/greensock" folder and tried using this:

 

arrowRightBtn.addEventListener(MouseEvent.CLICK, rtBtn01);

arrowRightBtn.buttonMode=true;

arrowRightBtn.useHandCursor=true;

 

function rtBtn01(event:MouseEvent) {

myTimeline.getLabelAfter();

}

 

and i'm getting an error:

1061: Call to a possibly undefined method getLabelAfter through a reference with static type com.greensock:TimelineMax.

Link to comment
Share on other sites

it was the ASO files...

 

its working now ... but not functioning like I'd like it to. I'm sure it's my error :mrgreen:

 

when I click an arrow, I'd like for it to go to the next label in the timeline.

Here's my code:

 

function rtBtn01(event:MouseEvent) {
myTimeline.getLabelAfter(1);
myTimeline.paused=! myTimeline.paused;
}

 

any idea what I'm doing wrong?

Link to comment
Share on other sites

If you want to get the next label after the current time, you'd do:

 

myTimeline.getLabelAfter(myTimeline.currentTime);

 

I considered having a getNextLabel(), but it wouldn't be as flexible as getLabelAfter() because getLabelAfter() doesn't depend on the timeline to be at a certain point - you can search for next/previous labels anytime/anywhere.

 

Keep in mind that getLabelAfter() returns a String - the name of the label. It doesn't actually make the timeline play to that point. If you want to make it play to that point, you could do:

 

var label:String = myTimeline.getLabelAfter(myTimeline.currentTime);
var targetTime:Number = myTimeline.getLabelTime(label);
var duration:Number = Math.abs(targetTime - myTimeline.currentTime);
TweenLite.to(myTimeline, duration, {currentTime:targetTime, ease:Linear.easeNone});

 

EDIT: I just added a tweenTo() method to TimelineMax that handles this for you! So it's as easy as myTimeline.tweenTo("myLabel")

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