Jump to content
Search Community

Tween effect only works the first time properly

mrlem313 test
Moderator Tag

Recommended Posts

I have some tweening going on with a few MCs. The first time things go well. After these tweens, I have a button that reset the objects' properties back using tweens again. That's where things get "funny". Once the "reset" happens, when I run the initial series of tweens on these MCs, the effect is totally off. Can someone help me with this?

Link to comment
Share on other sites

// The code below works fine the first time, then...

 

for (var i=0;i<4;i++) {

trace(prod_array+": "+Prod_Selected.indexOf(prod_array));

if (Prod_Selected.indexOf(prod_array) < 0) {

switch (i) {

case 0:

TweenMax.to(Object(root).eTrain, .5, {autoAlpha:0});

break;

case 1:

TweenMax.to(Object(root).eTrainer, .5, {autoAlpha:0, delay: .3});

break;

case 2:

TweenMax.to(Object(root).eTrain_Enterprise, .5, {autoAlpha:0, delay: .5});

break;

case 3:

TweenMax.to(Object(root).eTrain_Ent_Corp_Ed, .5, {autoAlpha:0, delay: .7});

break;

}

}

 

// I return these MC's to their starting positions and alpha with the following code (called in a function) This code does not work the way I expected. The tweens are not smooth at all:

eTrain.x = 2;

TweenMax.to(eTrain, .5, {autoAlpha:100, delay:.5});

 

eTrainer.x = 153.95;

TweenMax.to(eTrainer, .5, {autoAlpha:100, delay: .7});

 

eTrain_Enterprise.x = 298.25;

TweenMax.to(eTrain_Enterprise, .5, {autoAlpha:100, delay: .9});

 

eTrain_Ent_Corp_Ed.x = 422.60;

TweenMax.to(eTrain_Ent_Corp_Ed, .5, {autoAlpha:100, delay: 1.1});

 

// When I run the first part of code again, things do not run like the first time.

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