Comments

Comments are used to add notes to scripts, so that you can make your scripts easier to understand, and keep track of what you intended and for passing information to readers viewing your scripts.

  • Comments are preceded with two forward slashes (//), as shown in the following:

x = “This is “;
x += “Quicker”;
trace (x);
// returns “This is Quicker” in the Output panel

  • You can also create a comment block by adding /* at the beginning of the commented lines and */ at the end:

// 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;

Comments are grey in the scripts, and don’t execute when the scripts run.

Comments