Tutorial: Use TweenMax libs create a realistic tween with a simple example

Requierements

See the previous tutorial about how to install the TweenMax libraries in Flash IDE.

Usage

Tweens

We will try to test some tweens and easing  only with TweenMax to make this animation:

Click on Insert > New symbol

  1. Type: MovieClip
  2. Enter the name: Apple
  3. Check: Export for ActionScript
  4. Enter the classname: Apple
  5. Then click OK

new_symbol

Enter in the Apple symbol from your library:

library

Then draw an beautiful apple :).

Let’s the origin in the center of this image

apple

Click on the “Stage” from the navigator on the top.

stage

Now you are in an empty main stage.

Hit the right click from the frame on the timeline and select : Actions to open the Actions pannel.

timeline

Then just add this line in the Actions pannel.

If the library is correctly added in your Flash animation. Flash will autocomplete the package like this:

import

The TweenMax.to method can interpolate a tween with any properties.

For example this line can move an object to x and y coordinates.

Now add this lines of code:

Tutorial: install TweenMax libs ActionScript 3 with Flash IDE for beginners

About Tweenmax

In this tutorial I will show you how to include the TweenMax ActionScript 3.0 libs in Flash.
The TweenMax libs are available in ActionScript 3.0 and 2.0 developed by the GreenSock team.

This libs can help you a lot in game development.

You can easily use this libs to :

  • Move objects
  • Call functions with delay
  • Morph colors or alpha
  • Use easing : (Bounce, elastic, slow down, …)
  • Handle: timers, tweens and animations with one class.

In few words: This libs kicks ass !

Here some examples. I picked up this swf from greensock.com :

Let’s start

Installation

Download the TweenMax libraries form the website : http://www.greensock.com/tweenmax/

greensock

Then unzip the file.

Open Flash and create a new ActionScript 3.0 file

flash

Then add the libraries to your file by clicking on the wrench.

as3

  1. Click on the Library path tab
  2. Click on the “+”
  3. Click on the swc icon
  4. Select the greensock.swc from the folder you just unzip.
  5. And click OK

add_tweenmax_libs

Annnnnnnnd…. It’s done!