How to install tweenLite or tweenMax
Many of my tutorials use the tweenLite or tweenMax plug-ins for tweening effects. A common question I get asked all the time is, how to do you install tweenLite or tweenMax? Below is a quick tutorial on how to set up tweenLite or tweenMax.
1. Go to blog.greensock.com and download the tweenLite or tweenMax zip file. Unzip the file and place the ‘gs’ folder inside the same folder as your Fla file. This means Flash will be able to find the class files from the ‘gs’ folder when you publish your swf file.
You can also set up classpath which means you can place the ‘gs’ folder anywhere on your hard drive, but you need to make sure Flash has a reference to the folder. Go to Edit > Preferences > Actionscript > Actionscript 3.0 settings and then select the ‘add new path’ button and browse to the location of your class files then click ok.
2.Before tweenLite or tweenMax will work you need to import the class files. This is so that Flash knows where to look for the files. The most common import statements are show below.
(The following code will only work depending on the version of tweenLite/tweenMax you are using. If you are using version 11 then look at the 'update' section)
//Imports the tweenLite class
import gs.TweenLite;
//Imports all the classes in the gs folder.
import gs.*;
The tweenLite and tweenMax plug-ins come with two demo files that show exactly which statements you need to import for each property, so be sure to keep these files for reference.
UPDATE:
The new version 11 of tweenLite uses a different import statment. The base package 'gs' has changed to 'com.greensock' to comply with the industry standard. So you will now have to write the following.
//Imports all the classes in the greensock folder.
import com.greensock.*;







4 comments:
Hi,
After I have done EXACTLY the same as the instruction above. I got the same error message "5001: The name of package 'com.greensock' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. D:\EVTEK 2008-2009\FlashLite in HTML\greensock\TweenLite.as"
Do I need to change anything in that TweenLite.as file? Cos seems like that "com.greensock" package has some problem.
@Huy
You have imported the wrong statements make sure you import the correct statements.
You do not need to modify anything in the TweenLite.as file.
I get the same error message "5001: The name of package 'com.greensock' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. D:\EVTEK 2008-2009\FlashLite in HTML\greensock\TweenLite.as"
i put the correct statements(i got them from a tutorial). it was a readymade .fla file, just had to rename the 'greensock' folder to 'gs'. the import statements are correct... how can i fix this??
@Vinay
The new version of tweenlite uses a slighty different import statement. I have updated the article above.
Post a Comment