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

How can i use TweenLite or TweenMax in this case?

Recommended Posts

Hello,

Sorry for my english, i'm frensh speaking.

I made an exercice from the Thibault Imbert's book "Pratique d'Action Script 3".

He uses the fl Tween Class to do this exercice but I want to do it with the TweenLite Class and I don't find the solution could you help me?

Here is the code:

import fl.transitions.Tween;

import fl.transitions.easing.Elastic;

var tableauLabel:Array = new Array ("Accueil", "Historique", "Contact", "Jeux");

var containerBtn:Sprite = new Sprite();

containerBtn.x = 20;

var lng:int = tableauLabel.length;

var btn:Bouton;

for (var i:int = 0; i< lng; i++){

btn = new Bouton();

btn.y = 20 + i*(btn.height + 10);

btn.buttonMode = true;

btn.mouseChildren = false;

btn.maLegende.text = tableauLabel;

btn.tween = new Tween (btn, "y", Elastic.easeOut, 0, 20 + i*(btn.height + 10), 3, true);

}

}

Share on other sites

import com.greensock.*;
import com.greensock.easing.*;

assuming your button is starting with a y of 0:

btn.tween = TweenLite.to(btn, 3, {y:2-*(btn.height + 10), ease:Elastic.easeOut};

take a look at the interactive tweening demo here:

http://www.greensock.com/tweenlite/

enjoy greensock.

Carl