Jump to content


relative vs absolute values in GSAP Flash Pro CC 2015

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I've been catching back up with Flash Pro and Greensock using the new Canvas and WebGL file formats. One thing I noticed is when I try to use relative numbers with Greensock I get unexpected results.


In AS3 I would have use something like this

TweenLite.to(mc, 1, {x:"500"});

and the mc would have moved 500px to the right of where it was sitting on the stage.


When I use the same piece of code in Flash Pro in JS instead of AS3

TweenLite.to(this.mc, 1, {x:"500"});

The mc seems to move to a location that is far more then 500px and not always in the direction that I thought it would move..


Since I'm using Flash Pro I'm not sure I can recreate this in codepen?


Again this might be an issue with CreateJs and not GSAP.

Link to comment
Share on other sites

I don't know how it worked in AS, but a string does not make it relative. Those values will be parsed into an absolute value. Try these...

// Increase
TweenLite.to(mc, 1, {x:"+=500"});

// Decrease
TweenLite.to(mc, 1, {x:"-=500"});
  • Like 3
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.