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 forward 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 (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:

// The code below runs
var x:Number = 15;
var y:Number = 20;
// The code below doesn't run
/*
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();
}
*/
// The code below runs
var name:String = "My name is";
var age:Number = 20;