Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

incremental tween

Recommended Posts

This might be a very basic question, but I wanted to know that if I wanted to move a mc by say 100 px every time a button was clicked. how would I do that?


TweenLite.to(list_mc, 0.75, {x:15});


This would move a mc only once to x = 15 right?


Basically I have two buttons left and right and I want list_mc to move a certain number of pixels when either one is clicked in left and right directions respectively.


Thank you

Link to comment
Share on other sites

Relative vs absolute values


When a value is cast as a String, TweenLite and TweenMax will interpret it as relative. For example, let’s say you want to tween mc 100 pixels up from where it is but you don’t know exactly what y-coordinate that represents:


TweenLite.to(mc, 1, {y:"-100"});

//or to cast a numeric variable as a String...
var destY:Number = -100;
TweenLite.to(mc, 1, {y:String(destY)});


Assuming you have your eventListeners sorted, you should have no problem using the following:

TweenLite.to(list_mc, 0.75, {x:"15"}); // right
TweenLite.to(list_mc, 0.75, {x:"-15"}); // left

(you may or may not want to set an 'overwrite' value if you are allowing list_mc to be moved multiple times)


Hope that helps :D

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.