Jump to content
GreenSock

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

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;

addChild (containerBtn);

 

 

function creerMenu ():void {

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);

containerBtn.addChild (btn);

}

}

 

creerMenu ()

 

Thank you for your answer!

Link to comment
Share on other sites

add the imports

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

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