- Home
- Articles
- Best Practices
- Setting up a Development Environment and Using gProject to Create Custom Classes
Setting up a Development Environment and Using gProject to Create Custom Classes

Create a MovieClip and create a custom Class with gProject
Click on your text and hit F8 to create a new MovieClip. Give it the name Main and an instance name of Main.

In your gProject panel click the dropdown and click on new project and give it a name (mine is DevelopmentTutorial)

Now in the library click on the Main symbol so it is highlighted. Then click on the gProject panel and hit the new Class icon:
The gProject Class creation dialog box pops up and here is where we can place the our new Class in a custom package.
Let me digress for a minute and explain packages: Packages may sound a bit scary at first but they are really nothing more then a custom directory structure so that custom Class filenames do not collide. So say I have a custom Class called Customer. Well in a huge application it is possible that I am using a custom Class that someone else built named Customer. This would be bad because now I have two Classes with the same name and the Flash compiler will not know which one I want to use.
If I place my custom Customer Class in a unique directory structure and then point Flash to it then there is no chance (well very slim chance anyway) that the other Customer class will have the same directory structure and therefore no collision will occur.
So back to our Main Class creation dialog box. In the box where I put the name gProject allows me to define my package there as well. Not only that but gProject will create the directory structure for me. Further, it will organize my library so that it mimics my package directory structure. Cool hu? Thanks, Grant Skinner.
So here is my dialog box now:

Notice the name box has com.rezn8.Main. Commonly developers, in order to make their packages unique will put their site name backward. I work for a company called REZN8 so I take the website name rezn8.com and put it backwards like this com.rezn8 and then put the name of my new Class, Main so I now have:
com.rezn8.Main
I check Open, Bound, Use Selected, Fill UI Elements and Full Path as Linkage
This creates the Main class for me, the packages (directories), it fills in any UI elements that may be in Main (currently there are none but soon there will be) and adds the linkage to the Main MovieClip of com.rezn8.Main.as.
Now we have our custom Class. Pretty painless, right? Lets now add a new MovieClip into Main and then make a custom class for it.
