AS文件是怎么引用到FLASH

AS文件是怎么引用到FLASH
我想把脚本代放在外面 不想放在FLASH里面

包括指定文件的内容,就像该文件中的命令是调用脚本的一部分一样。编译时会调用 #include 指令。因此,如果对外部文件进行了任何更改,则必须保存该文件,并重新编译任何使用它的 FLA 文件。

如果对包含 #include 语句的脚本使用“语法检查”按钮,则也会检查所包括文件的语法。

您可以在 FLA 文件和外部脚本文件中使用 #include,但不能在 ActionScript 2.0 类文件中使用。

您可以对要包括的文件不指定路径、指定相对路径或指定绝对路径。如果您不指定路径,则 AS 文件必须位于以下位置之一:

与 FLA 文件位于同一个目录。与包含 #include 语句的脚本位于同一个目录
全局 Include 目录,该目录为以下之一: -- Windows 2000 或 Windows XP:C:\Documents and Settings\user\Local Settings\Application Data\Adobe\Flash CS3\language\Configuration\Include -- Macintosh OS X:Hard Drive/Users/Library/Application Support/Adobe/Flash CS3/language/Configuration/Include
Flash CS3 program\language\First Run\Include 目录;如果您在此处保存一个文件,则在下次启动 Flash 时,会将此文件复制到全局 Include 目录中。
若要为 AS 文件指定相对路径,请使用单个点 (.)来表示当前目录,使用两个点 (..) 来表示父目录,并使用正斜杠 (/) 来表示子目录。请参阅以下示例部分。

若要为 AS 文件指定绝对路径,请使用您的平台(Macintosh 或 Windows)所支持的格式。请参阅以下示例部分。(不建议使用此方法,因为此方法要求任一编译此脚本的计算机上均具备相同的目录结构。)

如果您将文件放在 First Run/Include 目录或全局 Include 目录中,请备份这些文件。如果您需要卸载或重新安装 Flash,可能会删除和覆盖这些目录。

不要将分号 (;) 放在包含 #include 指令的行的末尾。

可用性:ActionScript 1.0、Flash Player 4.0

参数
[path]filename.as:String ― filename.as 要添加到“动作”面板或当前脚本中的脚本的文件名和可选路径;建议使用 .as 作为文件扩展名。

示例
下列示例说明指定要包含在脚本中的文件的路径的各种方法:

// Note that #include statements do not end with a semicolon (;)
// AS file is in same directory as FLA file or script
// or is in the global Include directory or the First Run/Include directory
#include "init_script.as"

// AS file is in a subdirectory of one of the above directories
// The subdirectory is named "FLA_includes"
#include "FLA_includes/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"
// AS file is in a directory at the same level as one of the above directories
// AS file is in a directory at the same level as the directory
// that contains the script file
// 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"
--------------------------------------------------------------------------------
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-08-16
容易得,写一个类,然后关联舞台
第2个回答  2013-08-16
放里面比较简单……
相似回答