ActionScript.org Flash, Flex and ActionScript Resources - http://www.actionscript.org/resources
Actions using External Scripts
http://www.actionscript.org/resources/articles/30/1/Actions-using-External-Scripts/Page1.html
Jesse Stratford
Jesse lives in Melbourne Australia and is the Cofounder and webmaster of http://ActionScript.org. Once a full-time Flash enthusiast, teacher, author, freelancer and speaker Jesse's now leads a double life -- management consultant by day, http://ActionScript.org director by night. He enjoys participating actively in community and the wider Flash scene when he has time. 
By Jesse Stratford
Published on September 9, 2005
 
Difficulty Level: Beginner
Requirements: Flash 5 and above.

Page 1 of 1
Difficulty Level: Beginner
Requirements: Flash 5 and above. If you have code which you use repeatedly across multiple files, you can save time by writing it once and using the include action. This action is also very useful when working as part of a team or on large projects, as large amounts of scripting in the Actions Panel can reduce Flash's performance (at edit time).

You can write your script in any plain text editor and save it with .as extension (recommended but not necessary).

To include the code in your external source file use:

[as]#include "myscript.as"
[/as] Note that the include action takes place at publish time so if you change the contents of your .as file you must republish the SWF for the changes to take effect. This means you don't need to upload your .as file to your web server for the SWF to work. Also note you may not have comments or a semicolon on the same line as an include command.