Jump to content
GreenSock

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

Importing classes (AS2) [SOLVED]

Recommended Posts

Hi,

im a total beginner in tweening and in importing classes... i followed the instructions given on the website but it doesnt work and i dont know why.

Here is what i wrote, in ActionScript2

 

stop();

import com.greensock.TweenLite;

import com.greensock.*;

import com.greensock.easing.*;

bentrer1.onRelease = function() {

trace("release");

TweenLite.to(haut1, 5, {x:100, y:200, alpha:0});

TweenLite.to(bentrer1, 3, {x:1020, y:437.1, alpha:0});

TweenLite.to(bentrer2, 3, {x:1020, y:479.1, alpha:0});

TweenLite.to(bentrer3, 3, {x:1020, y:521.1, alpha:0});

}

 

haut1 is a movieclip, bentrer1, 2 and 3 are buttons, and noting happens at all.

I wrote that code in my main scene. Does anyone can help ?

Thanks!

Link to comment
Share on other sites

firstly, make sure your import statements are the top most thing in your code (above the stop action). the second import statement will import what the first imports as well, so you can take out the first import.

 

secondly, make sure the paths to your buttons are correct. it could be a scope issue.

 

P.S. i haven't used AS2 in over 2 years so I hope i'm not just forgetting something.

Link to comment
Share on other sites

Thanks. i put the import statement above all, and quited the first import statement and nothing changes...

im sure my button works because it traces "release"...

should i write the import statement in a distinct layer or in a special place ?

Link to comment
Share on other sites

You're using the wrong property names. Like "x" instead of "_x", and "y" instead of "_y". Those all changed from AS2 to AS3, but it has nothing to do with TweenLite/Max - it's just the core language that was changed.

 

Your tweens would look like:

TweenLite.to(haut1, 5, {_x:100, _y:200, _alpha:0});
TweenLite.to(bentrer1, 3, {_x:1020, _y:437.1, _alpha:0});
TweenLite.to(bentrer2, 3, {_x:1020, _y:479.1, _alpha:0});
TweenLite.to(bentrer3, 3, {_x:1020, _y:521.1, _alpha:0}); 

Link to comment
Share on other sites

Thank you very much, that was the problem ! :D

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