Using comments to add notes to scripts is highly recommended. Comments are useful for keeping track of what you intended and for passing information to other developers if you work in a collaborative environment or are providing samples. Even a simple script is easier to understand if you make notes as you create it. You can also comment out scripts that you may want to use later or partially working scripts.
To indicate that a line or portion of a line is a comment, precede the comment
with two forward slashes (//):
on(release) {
// goes to frame ten of this timeline
gotoAndStop(10);
}
When Syntax coloring is enabled (see Syntax highlighting), comments are gray by default. Comments can be any length without affecting the size of the exported file, and they do not need to follow rules for ActionScript syntax or keywords.
If you want to "comment out" an entire portion of your script, place it in a comment block rather than adding // at the beginning of each line. This technique is easier and is useful when you want to test only parts of a script by commenting out large chunks of it.
To create a comment block, place /* at the beginning of the commented lines
and */ at the end. For example, when the following script runs, none of the
code in the comment block is executed:
/*
on(release) {
// goes to frame ten of this timeline
gotoAndStop(10);
}
*/
Debugging
Debugging is simply the process of figuring out why your script is not working.
Checking syntax in the actions panel will often help you find the bugs. It will pop-up the output window with the problem listed in it, if there is a problem.
You can also test your movie with the debugger on. Turn it by choosing control/debug movie from the main menu. This will test your movie and open the debugger. You have to close your movie in the testing environment, keeping the debugger open, and choose control/debug movie again to get the debugger to work. Once it is up and running, it will continue to work. It is a little buggy itself.
You can also list objects and variables in the testing movie environment under the Debug menu.