Jump to content
GreenSock

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

From stored in variable not working with reverse

Recommended Posts

Hi

 

This reverse button is working for me:

 

import com.greensock.*;

import com.greensock.easing.*;

 

var myTween:TweenMax = new TweenMax(mc_02, 1, { _y:250});

//myTween.pause();

 

 

btn_01.onRelease = function():Void

{

myTween.reverse();

trace("btn_01");

};

----------------

 

When I add a from or fromTo or to - the reverse isn't working, does anybody now why?

 

Like this:

import com.greensock.*;

import com.greensock.easing.*;

 

var myTween:TweenMax = new TweenMax.from(mc_02, 1, { _y:250});

//myTween.pause();

 

 

btn_01.onRelease = function():Void

{

myTween.reverse();

trace("btn_01");

};

 

Sorry for the rookie question, just starting out, seems like a great add-on to flash anyway.

 

Cheers

Link to comment
Share on other sites

no problem, you can only use the "new" keyword when the tween is a normal tween (to tween)

 

just do this:

 

var myTween:TweenMax = TweenMax.from(mc_02, 1, { _y:250});

Link to comment
Share on other sites

Hi Carl and thanks for clarifying this.

 

If I'm using from, to, or fromTo - then I can skip using "new"?

 

All of a sudden everything stopped working, including all of my earlier files form today...nothing helped - downloaded the greensock package again then everything is back on track ...puh..is this happening often to users?

 

Anyway, this i great!! really like this system. Thanks for the help!

Link to comment
Share on other sites

the behavior you describe is very odd. most likely something in your setup other than GreenSock is the issue. I have never heard of that happening.

you could have saved your fla to the wrong directory, coded something wrong or Flash could have been acting up... I don't know, it just sounds weird. GreenSock is a VERY stable platform doesn't have any issues with working intermittantly.

 

---

 

 

The only time you should use new is when you want the functionality of a to() tween.

Link to comment
Share on other sites

The only time you should use new is when you want the functionality of a to() tween.

Just to clarify, here's a little-known tidbit: you can do a from() tween using the "new" keyword and adding runBackwards:true like:

 

var tween:TweenLite = new TweenLite(mc, 1, {x:100, runBackwards:true});
//same as:
var tween:TweenLite = TweenLite.from(mc, 1, {x:100}); 

 

And you can do a TweenMax.fromTo() tween by nesting a "startAt" object, like this:

 

var tween:TweenMax = new TweenMax(mc, 1, {x:100, startAt:{x:0}});
//same as:
var tween:TweenMax = TweenMax.fromTo(mc, 1, {x:0}, {x:100});

 

Now you can consider yourself a true GreenSock geek. :)

Link to comment
Share on other sites

very cool. thanks!

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