User Guide

#include 175
#include
Availability
Flash Player 4.
Usage
#include "[path] filename.as"
Note: Do not place a semicolon (;) at the end of the line that contains the #include statement.
Parameters
[path] filename.as
The filename and optional path for the script to add to the current
script; .as is the recommended filename extension.
Returns
Nothing.
Description
Compiler directive: includes the contents of the specified file, as if the commands in the file are
part of the calling script. The
#include directive is invoked at compile time. Therefore, if you
make any changes to an external file, you must save the file and recompile any FLA files that use
it.
You can use
#include in script files, but not in class files.
You can specify no path, a relative path, or an absolute path for the file to be included. If you
dont specify a path, the AS file must be in the same directory as the script containing the
#include statement.
To specify a relative path for the AS file, use a single dot (.) to indicate the current directory, two
dots (
..) to indicate a parent directory, and forward slashes (/) to indicate subdirectories. See the
following example section.
To specify an absolute path for the AS file, use the format supported by your platform (Macintosh
or Windows). See the following example section. (This usage is not recommended because it
requires the directory structure to be the same on any computer that you use to compile
the script.)
Example
The following examples show various ways of specifying a path for a file to be included in
your script:
// Note that #include statements do not end with a semicolon (;)
// AS file is in same directory as script
#include "init_script.as"
// AS file is in a subdirectory of the script file directory
// The subdirectory is named "SCRIPT_includes"
#include "SCRIPT_includes/init_script.as"
CHAPTER 5
ActionScript Core Language Elements