Understanding ActionScript > About scripting in ActionScript > About planning and debugging scripts

About planning and debugging scripts

When you write scripts for an entire movie, the quantity and variety of scripts can be large. Deciding which actions to use, how to structure scripts effectively, and where scripts should be placed requires careful planning and testing, especially as the complexity of your movie grows.

Before you begin writing scripts, formulate your goal and understand what you want to achieve. This is as important—and typically as time consuming—as developing storyboards for your work. Start by writing out what you want to happen in the movie, as in this example:

I want to create my whole site using Flash.
Site visitors will be asked for their name, which will be reused in messages throughout the site.
The site will have a draggable navigation bar with buttons that link to each section of the site.
When a button is clicked, the new section will fade in to the center of the Stage.
One scene will have a contact form with the user's name already filled in.

When you know what you want, you can build the objects you need and write the scripts to control those objects.

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 part of a script working, choose Save As to save a version of the file (for example, myMovie01.fla) and start writing the next part. This approach will help you identify bugs efficiently and ensure that your ActionScript is solid as you write more complex scripts.