Naming conventions 733
Using naming conventions for your variable names can serve the following important
functions:
■ They make your code readable so that you can immediately identify a variable’s data type.
This can help students, those learning code, or developers unfamiliar with your code.
■ They are easy to search for and replace when necessary.
■ They help reduce conflicts with reserved words and language constructs.
■ They can help you distinguish between variables from different scopes (local variables,
class properties, parameters, and so on).
The following sections contain naming guidelines for writing ActionScript code, such as
naming files, variables, constants, components, and so on. “Formatting ActionScript syntax”
on page 764 discusses formatting conventions that are specific to ActionScript, and common
in other programming languages. “ActionScript coding conventions” on page 745 discusses
coding conventions that are specific to writing ActionScript and developing with Flash 8.
This section includes the following topics:
■ “General naming guidelines” on page 734
■ “Avoiding reserved words or language constructs” on page 734
■ “Naming variables” on page 736
■ “Naming constants” on page 738
■ “Naming Boolean variables” on page 738
■ “Naming functions and methods” on page 739
■ “Naming classes and objects” on page 739
■ “Naming packages” on page 741
■ “Naming interfaces” on page 741
■ “Naming custom components” on page 742
NOTE
Flash Player 7 and 8 loosely follow the ECMAScript (ECMA-262) edition 3 language
specification. It is useful to see this specification for information on how the language
works. (See www.ecma-international.org/publications/standards/Ecma-262.htm.)