Best Practices for Writing Scripts

If you use good authoring practices when you author your movie and write scripts, your movies will have fewer problems. Use the following guidelines to help prevent problems and to fix them quickly when they do occur.

Before you begin writing scripts, formulate your goal and understand what you want to achieve. This is good practice whether you want to achieve something simple such as a button that opens a new Web page, or something complex such as an entire Flash Web site. Planning your scripts is as important as developing storyboards for your work. Start by writing out what you want to happen in the movie, as in this example:

When you know what you want, you can use the ActionScript that you need to accomplish the tasks.

Getting scripts to work the way you want takes time—often more than one cycle of writing, testing, and debugging. The best approach is to start simple and test your work frequently. When you get one section of a script working, choose Save As to save a version of the file (for example, myDoc01.fla) and start writing the next section. This approach will help you identify trouble spots efficiently and ensure that your ActionScript is solid as you begin to write more complex scripts.