Name
#include Directive — import the text of an external ActionScript file
Availability
Flash 5
Synopsis
#include path
Arguments
- path
A string indicating the name and location of the script file to import, which may be specified relative to the
.fla
file or as an absolute path (see samples under Example). Note that forward slashes, not backslashes should be used in the path. Script files should be named with the.as
file extension.
Description
The
#include
directive brings
script text from an external text file (preferably one with the
.as
extension) into the current script, placing
it directly where the #include
command occurs in
the script. The #include
operation is performed
at compile time, meaning that the text included in a movie is the
text that existed at the time the movie was tested, exported, or
published from the authoring tool. If the external file changes after
the movie is exported, the changes will not be reflected in the
movie. In order for the changes to be added to the movie, the movie
must be re-exported.
The #include
directive is used to incorporate the same block of code in multiple scripts or across Flash projects (much as you’d use an external asset library). You would do this in order to centralize your code, when maintaining code in a version-control system tool (such as CVS or Microsoft Visual Source Safe), or when using an external text editor that you prefer over the ActionScript editor. It is also handy when a programmer is working separately from, say, a ...
Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.