Writing and debugging scripts overview

In Macromedia Flash MX 2004 and Macromedia Flash MX Professional 2004, you can write scripts that are embedded in your FLA file or stored externally on your computer. (If you are writing ActionScript 2.0 class files, you must store each class as an external file that has the same name as the class.) To write embedded scripts, use the Actions panel and attach the action to a button or movie clip, or to a frame in the Timeline (see Controlling when ActionScript runs). To write external script files, you can use any text editor or code editor. In Flash Professional, you can also use the built-in Script window. For more information, see Using the Actions panel and Script window.

When using the ActionScript editor, you can also check syntax for errors, automatically format code, and use code hints to help you complete syntax. In addition, the punctuation balance feature helps you pair parentheses, braces, or brackets. For more information, see Using the ActionScript editor.

As you work on a document, test it often to ensure that it plays as smoothly as possible and that it plays as expected. You can use the Bandwidth Profiler to simulate how your document will appear at different connection speeds (see Testing document download performance). To test your scripts, you use a special debugging version of Flash Player that helps you troubleshoot. If you use good authoring techniques in your ActionScript, your scripts will be easier to troubleshoot when something behaves unexpectedly. For more information, see Debugging your scripts.