Use block, single-line, and trailing comments within the body of your class to comment on
your ActionScript code. For more information on using comments in class files, see
comments to classes" on page
ActionScript coding conventions
One of the most important aspects about programming is consistency, whether it relates to
variable naming schemes (covered in
(covered in
"Formatting ActionScript syntax" on page
placement of your ActionScript 2.0 code, which is covered in this section. You dramatically
simplify code debugging and maintenance if your code is organized and adheres to standards.
For more information on coding conventions, see the following topics:
"Keeping your ActionScript code in one place" on page 745
"Attaching code to objects" on page 746
"Handling scope" on page 747
"Structuring a class file" on page 751
"About using functions" on page 760
Keeping your ActionScript code in one place
Whenever possible, put your ActionScript 2.0 code in a single location, such as in one or
more external ActionScript files or on Frame 1 of the Timeline (when placed on the timeline,
the code is called a frame script).
If you put your ActionScript code in a frame script, put the ActionScript code on the first or
second frame on the Timeline, in a layer called Actions, which is the first or second layer on
the Timeline. Sometimes you might create two layers—an acceptable practice—for
ActionScript to separate functions. Some Flash applications do not always put all your code in
a single place (in particular, when you use screens or behaviors).
Despite these rare exceptions, you can usually put all your code in the same location. The
following are the advantages of placing your ActionScript in a single location:
Code is easy to find in a potentially complex source file.
Code is easy to debug.
744.
"Naming conventions" on page
732), formatting code
764), or coding standards and the
ActionScript coding conventions
"Adding
745
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?