Comments

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.

To indicate that a line or portion of a line is a comment, precede the comment with two slashes (//):

on(release) {
	// create new Date object
	myDate = new Date();
	currentMonth = myDate.getMonth();
	// convert month number to month name
	monthName = calcMonth(currentMonth);
	year = myDate.getFullYear();
	currentDate = myDate.getDate();
}

When Syntax Coloring is enabled (Edit > Preferences > ActionScript > Syntax Coloring), comments are grey 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, it is easier to place it in a comment block than it is to add // at the beginning of each line. This technique 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) {
	// create new Date object
	myDate = new Date();
	currentMonth = myDate.getMonth();
	// convert month number to month name
	monthName = calcMonth(currentMonth);
	year = myDate.getFullYear();
	currentDate = myDate.getDate();
}
*/

For more information, see Documenting your programs.