EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 743

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Using comments in your code 743
For more information on writing comments in your ActionScript code, see the following
sections:
“Writing good comments” on page 743
Adding comments to classes” on page 744
Writing good comments
Using comments consistently in your ActionScript 2.0 code allows you to describe complex
areas of code or important interactions that are not otherwise clear. Comments must clearly
explain the intent of the code and not just translate the code. If something is not readily
obvious in the code, add comments to it.
If you use the Auto Format tool with your code, you will notice that trailing comments (see
“Trailing comments” on page 134) move to the next line. You can add these comments after
you format your code, or you must modify the comments new placement after you use the
Auto Format tool.
For information on using comments in classes, see Adding comments to classes
on page 744.
Use the following guidelines when you add comments to your code:
Use block comments (/* and */) for multiline comments and single-line comments ( // )
for short comments.
You can also use a trailing comment on the same line as the ActionScript code if necessary.
Make sure you dont use comments to translate your ActionScript code.
You dont need to comment on elements that are obvious in the ActionScript code.
Comment on elements that are not readily obvious in the code.
In particular, add comments when the subject is not described in the surrounding
paragraphs.
Do not use cluttered comments.
A line of cluttered comments often contains equal signs (=) or asterisks (*). Instead, use
white space to separate your comments from ActionScript code.
NOTE
If you use the Auto Format tool to format ActionScript, you remove the white space.
Remember to add it back or use single- line comments (//) to maintain spacing; these
lines are easy to remove after you format your code.

Table of Contents

Related product manuals