MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 134

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

Trailing comments
You use trailing comments to add a comment on the same line as your code. These comments
appear on the same line as your ActionScript code. Developers commonly use trailing
comments to indicate what a variable contains or to describe or note the value that returns
from a line of ActionScript. Format trailing comments as follows:
var myAge:Number = 26; // variable for my age
trace(myAge); // 26
Space the comments to the right so readers can distinguish them from the code. Try to have
the comments line up with each other, if possible, as shown in the following code.
var myAge:Number = 28;
var myCountry:String = "Canada"; // my country
var myCoffee:String = "Hortons"; // my coffee preference
If you use autoformatting (click the Auto Format button in the Actions panel), trailing
comments move to the next line. Add these comments after you format your code, or you
must modify their placement after using the Auto Format button.
Comments inside classes
You use comments in your classes and interfaces to document them to help developers
understand the contents of your class. You might start all your class files with a comment that
provides the class name, its version number, the date, and your copyright. For example, you
might create documentation for your class that is similar to the following comment:
/**
Pelican class
version 1.2
10/10/2005
copyright Macromedia, Inc.
*/
Use block comments to describe files, data structures, methods, and descriptions of files. They
are usually placed at the beginning of a file and before or within a method.
There are two kinds of comments in a typical class or interface file: documentation comments
and implementation comments. Documentation comments are used to describe the code's
specifications and do not describe the implementation. You use documentation comments to
describe interfaces, classes, methods, and constructors. Implementation comments are used to
comment out code or to comment on the implementation of particular sections of code.
134
Syntax and Language Fundamentals
// my age

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents