DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Kalatravas has posted 29 posts at DZone. View Full User Profile

Actionscript 3 : TweenLite Basic Syndax

09.17.2010
| 3849 views |
  • submit to reddit
        // The TweenLite engine ads only 2K !!! file size on your project

It's important to note that you'll need to go to this link : http://blog.greensock.com/tweenliteas3/ and download TweenLite in order for any of the code in the post to work. It's also worth taking a look at the excellent documentation that you'll find at that same link.Need some basic tutorial ??? --->> http://www.greensock.com/get-started-tweening/
API documentation at this url ---->> http://www.greensock.com/as/docs/tween/

// www.tournasdimitrios1.wordpress.com

import gs.TweenLite;
import fl.motion.easing.*;

TweenLite.to(box,3 ,{x:400, rotation:180, scaleX:2, scaleY:2});

//another example 

box.x = 150;
box.y = 150;
TweenLite.to(box, 2,{x: 300});
TweenLite.to(box, 2,{y: 300, ease:Bounce.easeOut, overwrite:false});

//another example 


box.x = 150;
box.y = 150;
TweenLite.to(box, 2,{x: 300});
// here we define our onComplete callback function
TweenLite.to(box, 2,{y: 300,

                               ease:Bounce.easeOut,

                               overwrite:false,

                               onComplete: onJump});


function onJump():void {

    TweenLite.to(box, 1,{y: 100, rotation:180, ease:Back.easeOut});

}

//another example 

TweenLite.to(box, 2,{y: 300,
           ease: Bounce.easeOut,
           overwrite: false,
           onComplete: onJump,
           onCompleteParams: [box]});

function onJump(mc:MovieClip):void {
	TweenLite.to(mc, 1,{y: 100, rotation:180, ease:Back.easeOut});
}