Jump to content
Search Community

a Simple Tween help

johneebee test
Moderator Tag

Recommended Posts

I just want to click on one button to move a bar from the bottom then click again to slide back down. It will have animation that constantly runs and I need the user to see it and hide it when they want. Its text that syncs with the main timeline.

 

Any help?

 

Johnee Bee

Link to comment
Share on other sites

import com.greensock.*;
import flash.events.MouseEvent;

btn.addEventListener(MouseEvent.CLICK, toggleUpDown);

//create a tween that moves the bar up
//this tween is paused and reversed

var upTween:TweenMax= TweenMax.to(bar, 2, {y:0, paused:true, reversed:true});

//function that changes the direction of the tween and resumes it
//since the tween is reversed by default, clicking the btn the first time plays it forward

function toggleUpDown(e:MouseEvent):void{

       upTween.reversed = !upTween.reversed;

upTween.resume();
}

 

this tutorial here: http://www.snorkl.tv/2011/08/peacock-ch ... melinemax/

discusses this technique in the context of a TimelineMax but the main principles apply to single TweenMax tweens as well.

 

cs4 files attached

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.
×
×
  • Create New...