402
Chapter 12: ActionScript Dictionary
Description
Compiler directive: includes the contents of the specified file, as if the commands in the file were
part of the calling script itself. 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.
If you use the Check Syntax button for a script that contains
#include
statements, the syntax of
the included files is also checked.
You can use
#include
in FLA files and in external script files, but not in ActionScript 2.0
class files.
You can specify no path, a relative path, or an absolute path for the file to be included.
•
If you don’t specify a path, the AS file must be in the same directory as the FLA file or the
script containing the
#include
statement.
•
To specify a path for the AS file relative to the FLA file or script, use a single dot (.) to indicate
the current directory, two dots (
..
) to indicate a parent directory, and forward slashes (
/
). See
the following examples.
•
To specify an absolute path for the AS file, use the format supported by your platform
(Macintosh or Windows). See the following examples. However, this usage is not
recommended, because it requires that the directory structure be the same on any machine 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 FLA file or script
#include "init_script.as"
// AS file is in a subdirectory of the directory
// containing the FLA file or script
// The subdirectory is named "FLA_includes"
#include "FLA_includes/init_script.as"
// AS file is in a directory at the same level as the FLA file or script
// The directory is named "ALL_includes"
#include "../ALL_includes/init_script.as"
// AS file is specified by an absolute path in Windows
// Note use of forward slashes, not backslashes
#include "C:/Flash_scripts/init_script.as"
// AS file is specified by an absolute path on Macintosh
#include "Mac HD:Flash_scripts:init_script.as"
See also
import
Summary of Contents for FLASH MX 2004 - ACTIONSCRIPT
Page 1: ...ActionScript Reference Guide...
Page 8: ...8 Contents...
Page 12: ......
Page 24: ...24 Chapter 1 What s New in Flash MX 2004 ActionScript...
Page 54: ...54 Chapter 2 ActionScript Basics...
Page 80: ...80 Chapter 3 Writing and Debugging Scripts...
Page 82: ......
Page 110: ...110 Chapter 5 Creating Interaction with ActionScript...
Page 112: ......
Page 120: ...120 Chapter 6 Using the Built In Classes...
Page 176: ......
Page 192: ...192 Chapter 10 Working with External Data...
Page 202: ...202 Chapter 11 Working with External Media...
Page 204: ......
Page 782: ...782 Chapter 12 ActionScript Dictionary...
Page 793: ...Other keys 793 221 222 Key Key code...
Page 794: ...794 Appendix C Keyboard Keys and Key Code Values...
Page 798: ...798 Appendix D Writing Scripts for Earlier Versions of Flash Player...
Page 806: ...806 Appendix E Object Oriented Programming with ActionScript 1...
Page 816: ...816 Index...