User Guide

Optimizing ActionScript performance 79
For example, suppose your application attempts to load an XML file that’s 100 KB, but the
devices operating system has allocated only 30 KB to handle that incoming data stream. In
this case, Flash Lite displays an error message to the user, indicating that not enough memory
is available.
To load large amounts of data, it’s best to separate the data into smaller pieces—for example,
into several XML files—and make several data-loading calls for each piece. The size of each
piece of data, and therefore the number of data-loading calls you need to make, will probably
vary by device and application. To determine an appropriate balance between the number of
data requests and the likelihood of a memory failure, test your applications on each target
device.
Excluding classes from compilation
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, especially
those that access many of the same classes. Excluding classes helps you avoid duplicating
classes in those files.
To exclude classes from compilation:
1. Create a new XML file.
2. Name the XML file FLA_filename_exclude.xml, where FLA_filename is the name of your
FLA file without the .fla extension.
For example, if your FLA file is sellStocks.fla, the XML filename must be
sellStocks_exclude.xml.
3. Save the file in the same directory as the FLA file.
4. Place the following tags in the XML file:
<excludeAssets>
<asset name="className1" />
<asset name="className2" />
</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. Add as many as you require for your application.
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 name="mx.screens.Slide" />
</excludeAssets>