Tuesday, 3 November 2009

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.*;

12 comments:

Huy 3 November 2009 at 13:52  

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.

iliketo 10 November 2009 at 09:19  

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

Vinay 12 January 2010 at 04:17  

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??

iliketo 12 January 2010 at 07:03  

@Vinay

The new version of tweenlite uses a slighty different import statement. I have updated the article above.

Dreisdman 4 May 2010 at 22:11  

I also 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. I used v.10 for AS3 to my AS3 file and it should have the correct import statements in it. Can you pls help me figure out how to by pass this? ty

iliketo 5 May 2010 at 10:22  

@Dreisdman

Is the 'com' folder in the same directory as your fla file?

Dreisdman 5 May 2010 at 20:09  

"correction" rather it says The name of package 'gs' does not reflect the location of this file.

But anyway yeah the 'gs' folder is in the same folder with my FLA file. What should I do now?

iliketo 6 May 2010 at 14:08  

@Dreisdman

What import statement are you using?

Mike 8 December 2010 at 15:29  

Hello,
I was getting the 5001 error as well and then I changed the "greensock" folder name to "gs" and it went away. There is still a problem though, gs.easing could not be found. I haven't deleted anything from the gs folder. Any ideas? I'm trying to do your 8ball tutorial.

iliketo 16 December 2010 at 12:18  

@Mike

You don't need to rename the folder.

Simply drag the 'com' folder into the same directory as the 8 ball tutorial.

GR 22 April 2011 at 06:54  

5001: The name of package 'gs' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. /Users/madhouseindia/Desktop/Learning Flash and Ascript/gs/TweenMax.as

iliketo 27 April 2011 at 03:58  

This tutorial was written back in 2009. There has since been an update to the greensock plugin. It now uses the following import statement

import com.greensock.*;

  COPYRIGHT © 2014 · ILIKE2FLASH · Theme by Ourblogtemplates

Back to TOP