Jump to content
Search Community

onStart / onStartParams

kaplan test
Moderator Tag

Recommended Posts

Hi,

 

I'm wondering why this doesn't work:

// clip is off stage and I want to move it on stage at 50, set it's alpha to 0 and fade it up.
TweenLite.to(clip_mc, 1, {onStart:onStartTween, onStartParams:[clip_mc], _alpha:100, overwrite:false});

function onStartTween(mc) {
mc._x = 50;
mc._alpha = 0;
}

 

Am I doing this all wrong?

 

It works the other way:

TweenLite.to(clip_mc, 1, {onStart:onStartTween, onStartParams:[clip_mc], _alpha:0, overwrite:false});

function onStartTween(mc) {
mc._x = 50;
mc._alpha = 100;
}

 

Any insight is appreciated, Thanks!

Dave K.

Link to comment
Share on other sites

No, it actually doesn't work the other way either. Let me explain....

 

When a tween initializes (renders for the first time), it records the starting and ending values between which it must interpolate. An onStart will be called immediately AFTER that initialization process, so the values have already been recorded. Trying to change them inside your onStart won't do any good - the tween will immediately apply the interpolated value that's between the starting and ending values according to the time. That's a good thing - trust me. To accomplish what you're trying to do, just use the onInit / onInitParams instead of onStart / onStartParams. Or just use TweenMax.fromTo() if you want to define the starting and ending values for your tween. That method isn't available in TweenLite, though.

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