You might also add the block, single-line, or trailing comments within the class's code. For
information on writing good comments within your code, see
on page
743. For general information about comments, see
on page
132,
"Multiline comments" on page
To learn how to use these custom class files in a SWF file, see
files in Flash" on page
Example: Using custom class files
in Flash
This example uses class files that are written in the example called
classes" on page
263, or you can download them from
classes/. If you completed
and ClassB.as on your hard disk.
Since the package name of the ClassA class file is
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 macromedia. Add a third, and final, subdirectory within the macromedia 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
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
To reference a class in another script, you must prefix the class name with the class's package
name. The combination of a class's name and its package path is the class's fully qualified class
name. If a class resides in a top-level classpath directory—not in a subdirectory in the
classpath directory—then its class name is also its fully qualified class name.
276
Classes
276.
"Example: Writing custom classes" on page
"Example: Writing custom classes" on page 263
"Importing classes and packages" on page
"Writing good comments"
"Single-line comments"
133, and
"Trailing comments" on page
"Example: Using custom class
www.helpexamples.com/flash/learnas/
com.macromedia.utils.ClassA
134.
"Example: Writing custom
263, locate ClassA.as
, you'll
276.
Need help?
Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?