Example: Using custom class files in Flash

This example uses class files that are written in the example called Example: Writing custom classes, or you can download them from www.helpexamples.com/flash/learnas/classes/. If you completed Example: Writing custom classes, locate ClassA.as and ClassB.as on your hard disk.

Since the package name of the ClassA class file is com.adobe.utils.ClassA, you'll need to make sure that you save the class files in the proper directory structure. Create a subfolder named com in the current directory. Within the com folder, add a new folder named adobe. Add a third, and final, subdirectory within the adobe folder named utils. Save both the ClassA.as and ClassB.as class files within this utils folder. Now you are ready to proceed with this example.

You can use the custom classes written in Example: Writing custom classes with a FLA file. In this example, you use the custom classes to create a small application in Flash. Your classes compile into the SWF file when you publish the document, and then everything works together. In the following exercises, you learn how classpaths work, how to use class files in your application, as well as how to import classes and packages.

To continue this example, proceed to Importing classes and packages.


Flash CS3