A WordBubble Class

Getting Set Up
Chris Bristol
I have been using Flash in my web development since version 4. As ActionScript became a more powerful language, I found myself fascinated by the interaction between it and PHP and MySQL. In recent years, I have worked at eliminating the use of the timeline altogether, building everything in pure AS3, and making my code reusable. The fantastic resources of the vast online Flash community has been a great source of help and inspiration. I hope to be able to give back a little of that. You can reach me via my website: Xty Digital Design
A Word About Class Packages and Class Libraries
If you are new to Classes, you may be a bit mystified by the Class Package structure. At the top of each Class you will see something like this:
package ca.xty.myUtils
And in the code where you import classes into your project you will have something like this:
import ca.xty.myUtils.WordBubble;
What this is telling you is that the WordBubble.as Class lives in a folder called myUtils. The myUtils folder lives in another folder called xty. The xty folder lives in another folder called ca. This is a conventional way to organize your classes. What you call your folders is up to you, but the objective here is to have a unique class path. People often use their domains since that pretty well guarantees you a unique path. To take full advantage of your library, the Flash IDE can be set up to automatically include your library. First, you need to make another folder to hold all these other folders. I call my folder flashClasses. Where you put the flashClasses folder on your computer doesn't really matter, but mine lives in the main folder where I keep all my flash projects. So, set up the flashClasses folder and then open up Flash. In CS4, go to Edit-> Preferences-> ActionScript. Down near the bottom, click on ActionScript 3.0 Settings. Near the top, you'll see a space labeled Source Path. Click the + sign to add a new path. Now click the folder icon to browse to the flashClasses folder you just made and click OK. When you set up the folder structure for your class library, put it all inside the flashClasses folder. Now Flash will include the flashClasses folder, and make all of it's contents, available to any of your movies with a simple import statement. So, when you use - import ca.xty.myUtils.WordBubble;, the path to the ca folder is assumed. This procedure makes it easy to organize your classes, and find them when you need them.
The alternative to the above procedure is to simply drop the ca folder into the same folder as your .fla, but if you are going to be serious about using Classes, it is worth the initial effort to get things set up properly. Enough housekeeping, let's get going.


