Jump to content
Search Community

Syntaxproblem: on .reverse() -> Change onStart/onComplete

Hippiesvin test
Moderator Tag

Recommended Posts

Hi Jack ... and merry Christmas :)

 

I can't figure out how to change "onStart" and "onComplete" on my TimelineMax object when I reverse it.

My problem simplified:

var TM:TimelineMax;

function show() {	
TM = new TimelineMax({onStart:merry, onComplete:hide);
TM.insertMultiple( TweenMax.allTo(AnArray, 1.0, {autoAlpha:1, 	ease:Quad.easeIn}, 0.2), 0);
}

function hide() {
TM({onStart:christmas, onComplete:show});
TM.reverse();
}

function merry() { ... }
function christmas() { ... }

show(); // start

Entering "hide" -function throws this error:

TypeError: Error #1006: value is not a function.

at myFla::hide()

at Function/http://adobe.com/AS3/2006/builtin::apply()

at com.greensock.core::TweenCore/complete()

at com.greensock::TimelineMax/complete()

at com.greensock::TimelineMax/renderTime()

at com.greensock.core::SimpleTimeline/renderTime()

at com.greensock::TweenLite$/updateAll()

Link to comment
Share on other sites

Yeah, you're using the wrong syntax. If you want to change an onStart or onComplete AFTER you've already created the instance, you'd need to edit the vars object directly, like myTimeline.vars.onStart = myFunction and myTimeline.vars.onComplete = myOtherFunction.

 

Also keep in mind that there's an onReverseComplete special property as well, so you can easily sense when a reversed timeline completes.

 

Have fun!

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