Jump to content
Search Community

Tweening from one mc to the next

curvwind8 test
Moderator Tag

Recommended Posts

Hello there.

 

Forgive me if this is a very simple question but I'm a bit rusty here.

 

I have a movie clip with 10 mc's inside of it. They are all different widths. I'd like for when a user clicks the next or previous arrow button that the parent movie clip would slide over to the next or previous child. As they each have different widths I'm having a tough time coming up with a command that will accomplish this. Does anyone have any ideas?

 

Thanks in advance :-)

Link to comment
Share on other sites

hello and welcome to the GreenSock forums.

 

there is nothing built into the GreenSock Tweening Platform that is going to manage this for you.

 

you can build an Array that stores all the x values. as the user clicks the "next" button you can grab the next value out of the array and apply it to a TweenLite tween.

 

 

something like:

 

var currentLocation:int = 0;
var locations:Array = [0, 150, 450, 700];

function goToNextLocation(event:MouseEvent):void{
    currentLocation++;
    TweenLite.to(myStripOfMovieClips, 1, {x:locations[currentLocation]});
}

 

keep in mind that you would also want to check to make sure that you don't go to a location that doesn't exist (beyond the limits of what is in the array).

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