134
Syntax and Language Fundamentals
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; // my age
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.
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...