User Guide
Excluding classes 273
If you experience problems in which Flash appears to be compiling older versions of a file you
have edited, delete the ASO files and then recompile. If you plan to delete ASO files, delete them
when Flash is not performing other operations, such as checking syntax or exporting SWFs.
There is a limit to how much code you can place in a single class: The bytecode for a class
definition in an exported SWF file cannot be larger than 32,767 bytes. If the bytecode is larger
than that limit, a warning message appears.
You can’t predict the size of the bytecode representation of a given class, but classes up to 1,500
lines usually don’t go over the limit.
If your class goes over the limit, move some of the code into another class. In general, it is good
OOP practice to keep classes relatively short.
Excluding classes
To reduce the size of a SWF file, you might want to exclude classes from compilation but still be
able to access and use them for type checking. For example, you might want to do this if you are
developing an application that uses multiple SWF files or shared libraries that access many of the
same classes, and you want to avoid duplicating classes in the files. To exclude classes from
compilation, create a specially named and formatted XML file and place it in the same directory
as the FLA file. Name the XML file FLA_filename_exclude.xml, where FLA_filename is the name
of your FLA file minus the extension. For example, if your FLA file is sellStocks.fla, the XML
filename must be sellStocks_exclude.xml.
Place the following tags in the XML file:
<excludeAssets>
<asset name="className1"></asset>
<asset name="className2"></asset>
...
</excludeAssets>
The values you specify for the name attributes in the <asset> tags are the names of classes you
want to exclude from the SWF file. For example, the following XML file excludes the
mx.core.UIObject and mx.screens.Slide classes from the SWF file:
<excludeAssets>
<asset name="mx.core.UIObject"></asset>
<asset name="mx.screens.Slide"></asset>
</excludeAssets>