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

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

Macromedia recommends the following formatting points to help promote readability in your
ActionScript code.
Put one blank line between paragraphs (modules) of ActionScript.
Paragraphs of ActionScript code are groups of logically related code. Adding a blank line
between them helps users read the ActionScript code and understand its logic.
Use consistent indentation in your code to help show the hierarchy of the
code's structure.
Use the same indentation style throughout your ActionScript code, and make sure that
you align the braces (
your ActionScript syntax is correct, Flash automatically indents the code correctly when
you press Enter (Windows) or Return (Macintosh). You can also click the Auto Format
button in the ActionScript editor (the Actions panel or Script window) to indent your
ActionScript code if the syntax is correct.
Use line breaks to make complex statements easier to read.
You can format some statements, such as conditional statements, in several ways.
Sometimes formatting statements across several lines rather than across a single line makes
your code easier to read.
Include a space after a keyword that is followed by parentheses [
The following ActionScript code shows an example of this:
do {
// something
} while (condition);
Don't put a space between a method name and parentheses
The following ActionScript code shows an example of this:
function checkLogin():Boolean {
// statements;
}
checkLogin();
or
printSize("size is " + foo + "\n");
Include a space after commas in a list of arguments.
Using spaces after commas makes it easier to distinguish between method calls and
keywords, as the following example shows:
function addItems(item1:Number, item2:Number):Number {
return (item1 + item2);
}
var sum:Number = addItems(1, 3);
) properly. Aligned braces improve the readability of your code. If
{}
].
()
.
Formatting ActionScript syntax
765

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