Jump to content
Search Community

Question regarding importing greensock classes

adifrank test
Moderator Tag

Recommended Posts

I'm a bit confused about which greensock classes need to be imported when using TweenMax, or TimeLineMax, etc.

My confusion could be due to my limited knowledge of AS3, but here's what's stumping me...

 

The first import line is usually:

 

import com.greensock.*;

 

From my understanding the asterisk means that all classes of greensock are imported. So I figure I'm covered for all classes in the com.greensock folder.

 

But then I often see examples where people are adding additional import lines in addition to com.greensock.*;

For example:

import com.greensock.easing.*;

 

So, I'd appreciate it if someone could please explain why the classes in com.greensock.easing aren't imported with the previous greensock.*

 

Thanks

Link to comment
Share on other sites

great question.

 

open up the greensock folder.

 

you will see a number of folders such as loading, easing, plugins etc (these are referred to as packages in programming terms)

there are also .as files such as TweenLite.as, TweenMax.as, TimelineLite.as etc. (classes)

 

when you do

 

import greensock.*;

 

the asterisk gives you access to all the as class files in the greensock folder.

 

it does not give you access to all the as files inside easing or the other packages.

that is why the easing classes have their own import

 

import greensock.easing.*;

 

here the asterisk means everything inside the easing folder or package.

 

------

 

if you start using loaderMax you will then need to import everything inside the loading folder

 

import com.greensock.loading*;

 

in short the * just gives you the as files in the folder that precede it.

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.
×
×
  • Create New...