// Set expiration date to a date in the past.
response.setDateHeader("Expires", 946080000000L); //Approx Jan 1, 2000
// Force always modified.
response.header("Last-Modified", new Date());
Reducing SWF file sizes
You can improve initial user experience by reducing the time it takes to start an application. Part of this time is
determined by the download process, where the SWF file is returned from the server to the client. The smaller the
SWF file, the shorter the download wait. In addition, reducing the size of the SWF file also results in a shorter
application initialization time. Larger SWF files take longer to unpack in Flash Player.
The mxmlc compiler includes several options that can help reduce SWF file size.
Using the bytecode optimizer
The bytecode optimizer can reduce the size of the Flex application’s SWF file by using bytecode merging and
peephole optimization. Peephole optimization removes redundant instructions from the bytecode.
If you are using Flex Builder or the mxmlc command-line compiler, you can set the optimize compiler option to
true, as the following example shows:
mxmlc -optimize=true MyApp.mxml
The default value of the optimize option is true.
Disabling debugging can make your SWF files smaller. When debugging is enabled, the Flex compilers include
line numbers and other navigational information in the SWF file that are only used in a debugging environment.
Disabling debugging reduces functionality of the fdb command-line debugger and the debugger built into Flex
To disable debugging, set the
debug compiler option to false. The default value for the mxmlc compiler is false.
The default value for the compc compiler is
For more information about debugging, see “Using the Command-Line Debugger” on page 245.
Using strict mode
When you set the strict compiler option to true, the compiler verifies that definitions and package names in
import statements are used in the application. If the imported classes are not used, the compiler reports an error.
The following example shows some examples of when strict mode throws a compiler error:
import flash.utils.Timer; // Error. This class is not used.