Jump to content
Search Community

Questions about altering the greensock class path [SOLVED]

DigitalOne test
Moderator Tag

Recommended Posts

Hey all,

 

I have all my Actionscript classes in a directory called "AS3 Classes", which I've pointed to in the Flash IDE.

 

All the greensock stuff resides in "AS3 Classes --->com --->greensock"

 

I'd like to change the name of the com folder, or get rid of it completely. However, the TweenMax/Lite Timeline, etc files all seem contain the import path starting with "com". If I change the name of the com folder, then I have to go into all the greensock files and change it there as well?? Is there any easier way to go about this?

 

As a side note, I'm a little confused about this "com" business. I read that people do this in order to avoid class conflicts on the server/internet... But none the actual .as files are ever uploaded to the server anyway, they just reside locally on the users system...so why the naming convention?

Link to comment
Share on other sites

The directory structure has nothing to do with server-side implementation. You're right - the classes get baked into your swf when you publish it anyway. The issue has to do with the compiler understanding what you mean by "TweenLite" for example (or any class). Let's say someone creates another class named "TweenLite" but it's completely different. Let's also say you want to use both of those classes in your swf. What do you do? How does the Flash compiler know which one you're talking about when you reference "TweenLite"? That's why these paths are important. Domain names are unique. In my case, I own "greensock.com" so if we use the industry standard naming convention for our packages (reverse domain), it guarantees that nobody else would create a "com.greensock.TweenLite" class. Maybe the other one would be "com.sillycompany.TweenLite" - that's fine because when you reference each class in your code, you can easily specify which "TweenLite" you're talking about using the packages.

 

I would strongly discourage you from altering the classpath. It's definitely frowned upon in professional development circles. There's a reason for the package names, and it can avoid a lot of confusion. If you alter the package name, you'll have to edit each class file every time there's an update (what a hassle) and you'll risk looking like an amateur. :)

 

I totally understand why you'd be confused by the "com" folder thing - I was too when I started. In fact, that's why I put my code in a much simpler "gs" directory. I thought it kept things clean and simple. But in reality, it was a silly mistake on my part and other professional developers in the community have brought it to my attention (one of whom was Grant Skinner), so in v11 I switched to the industry standard com.greensock instead.

Link to comment
Share on other sites

Thank you for clearing that up. That makes a little more sense.

 

I'm not going to change the class path, way too much work...lol Besides, in the event that someone does have to review/use my code, I'd like to stick to something everyone understands.

 

Yeah I noticed you changed the class path from what it used to be. It's kinda funny because before I ever really knew what greensock was, in all my older fla files that were either downloaded or tutorials, I noticed the "import .gs" directive. I knew at the time it was a tweening class, but I'm kicking myself for not using it sooner.

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