Project Organization 101

Whenever I start a new project, no matter how small the project is, I always follow these organization rules.

Each project sits inside of its own folder named after the project itself. If I am using Eclipse I create this from the Project wizard, if I am on the file system (in TextMate or E) I just put it in my main project folder called FlashDev.

Once the project folder has been created I put 3 folders inside of it:

  • bin – When all my swfs go, testing files, and anything I will need to push to the server when the project is done.
  • lib – Is my Library folder. I put all of my source files (not source code) in this folder. More on this later.
  • src – My source folder. This is where all of my classes go.

Setting up the lib folder

As I mentioned before this is the home of all of my source material. I usually set up a few standard folders like FLAs, PSDs, image (For assets I import into Flash’s Library not runtime assets), documents, and documentation (where my class documentation goes.

For the most part my projects only have 1 main FLA file, so I put it into the FLAs folder. Inside of that file I change the class path to “..\..\src” and that will auto magically link my FLA with the Classes on any OS I decide to check my project out into. A lot of people like to use the Flash Global Path but that doesn’t move with each file so I tend to only link shared libraries specific to the computer I am working on in the Global Path settings. While I am changeing the publishing settings I go over to the output paths and set them to “..\..\bin\[project_name].swf” and “..\..\bin\index.html”. This way, when I do a publish all of my compiled files go into the bin folder.

Setting up the bin folder

Think of the bin folder as what you would see on a web server. All of you external assets, data, and swfs should site here. When you are done with a job and the client wants a copy of the site, you can quickly zip up the bin folder and send it on its way (assuming you are not obligated to give them the source code). I put a few standard folders inside of bin like images (for images loaded at runtime), xml, js (for swfobject or any external interface code you are using), and flvs.

Setting up the src folder

The src folder is the root of you class library. I usually put a com folder at top and work out all of my packages from here. With the FLA properly linked to this folder, you shouldn’t have any worries as to loading your classes or hard coding a file system path to you com folder.

Larger Projects

This system also works great for larger projects. Lets say you have a project with multiple FLAs. Simply organize them into indevidual folders inside of lib\FLAs. To link them up to the src folder, simply set the class path to “..\..\..\src” or “..\..\..\..\src” if you FLA sits inside of a folder inside of a folder in lib.

To handle multiple swfs, I tent to create a swfs folder inside of bin, and change each FLA’s out put to “..\..\..\bin”. I always try to avoid using Flash’s path tool because it created files hard coded to the developers OS.

Hopefully this helps with setting up and keeping your projects organized. 99% of project structure is not the structure it self but the repetitive task of doing the same thing for each project. One of eclipse’s biggest complaints is that it is horrible for creating small and quick projects but I find that if I keep the same structure I spend less time planning where everything should go and more time developing.

If you use CVS (or SVN) and Eclipse, you have a great advantage in setting up template projects. Simply create one empty project, check it in, and next time you need to create a new project just check it out, disconnect it (from the team menu) and begin renaming it to fit you needs. Just remember that CVS ignores empty folder so you will have to fill the project with dummy files or skeletons of files you will use. Here is a sample project I use as my CVS check out template.

blog comments powered by Disqus