Jump to content
Search Community

using tweenlite, simple question [SOLVED]

tom314 test
Moderator Tag

Recommended Posts

I followed this tutorial ( http://www.republicofcode.com/tutorials ... slideshow/), but wanted to use the TweenLite-engine, so I changed some things. (see commented things, changed them to tweenlite)

 

function moveSlide() {

current_mc = _root.myClips_array[_root.target_mc];

//new Tween(current_mc, "_alpha", Strong.easeOut, 100, 0, 1, true);

TweenLite.from(current_mc, 1, {_alpha:100, ease:Cubic.easeOut});

 

_root.target_mc++;

if (_root.target_mc>=_root.myImagesNo) { _root.target_mc = 0; }

 

next_mc = _root.myClips_array[_root.target_mc];

//new Tween(next_mc, "_alpha", Strong.easeOut, 0, 100, 1, true);

TweenLite.to(next_mc, 1, {_alpha:100, ease:Cubic.easeOut});

}

 

And the transitions are more beautiful, go smoother etc.. but suddenly the loop is gone.

 

When the last image is displayed, it stops. I put in a trace command for the _root.target_mc and this is what it presents..

-1

0

1

2

3

4

5

6

7

0

1

2

etc..

 

so the loop still functions.

 

The problem only occurs when I use the TweenLite-engine.., what do I do wrong ?

Link to comment
Share on other sites

I suspect the problem lies in the fact that you are using a TweenLite.from() call to tween the current MovieClip from an _alpha of 100 to whatever it currently is when that function is called. According to your code, the _alpha would probably already by 100, so you'd be tweening from 100 to 100 (no tween really). The old Adobe Tween was tweening from 100 to 0. Don't worry - you can easily fix this. It looks to me like all you'd have to do is change this:

 

BAD: TweenLite.from(current_mc, 1, {_alpha:100, ease:Cubic.easeOut});

GOOD: TweenLite.to(current_mc, 1, {_alpha:0, ease:Cubic.easeOut});

 

If you want to be able to control the starting and ending values in the future (not that you need to in this case, but I wanted to point it out anyway) just like the Adobe Tween class, you have 2 options:

 

1) Set the starting value immediately before you do a TweenLite.to(), like:

 

mc._alpha = 100;
TweenLite.to(mc, 1, {_alpha:0});

2) Use TweenMax's fromTo() call (new in v11):

 

TweenMax.fromTo(mc, 1, {_alpha:100}, {_alpha:0});

 

Also, you might want to consider looking into the new TimelineMax class in v11 (http://blog.greensock.com/v11beta/). It allows you to set up a sequence of tweens and set a "repeat" parameter that will repeat the whole sequence a certain number of times or infinitely (by setting repeat to -1). You don't NEED to use TimelineMax at all in this case - I just wanted to make you aware of it because you might really like it.

Link to comment
Share on other sites

THANKS A LOT !!

 

You made me see the light ;)

 

It works now, and since I'm more and more busy with Flash development, I'll surely check out the new & improved possibilities of the TweenLite and TweenMax engine.

 

Keep up the good work !

 

Greetz,

Tom.

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