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

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

General naming guidelines
This section reviews naming guidelines for writing ActionScript code. Naming conventions
are important for writing logical code. The primary purpose is to improve the readability of
your ActionScript 2.0 code. Remember that all variables must have unique names. Names are
case-sensitive in Flash Player 7 and later. Do not use the same name with a different case,
because this can be confusing to programmers reading your code and can cause problems in
earlier versions of Flash that do not force case sensitivity. Keep the following guidelines in
mind when you name items such as variables, files, and classes in Flash:
Limit your use of abbreviations.
Use abbreviations consistently. An abbreviation must clearly stand for only one thing. For
example, the abbreviation "sec" might represent "section" and "second."
Concatenate words to create names.
Use mixed-cases (upper and lower case) when you concatenate words to distinguish
between each word for readability. For example, select
.
mypelican
Name a file by describing the process or item, such as
Don't use nondescriptive names for methods or variables.
For example, if you retrieve a piece of data that is the visitor's user name, you might use
the
getUserName()
example expresses what is happening rather than how you accomplish it.
Keep all names as short as possible.
Remember to keep names descriptive.
The following sections offer more detail on naming items such as variables, classes, packages,
and constants in your code.
Avoiding reserved words or language constructs
When naming instances and variables, avoid using reserved words, which can cause errors in
your code. Reserved words include keywords in the ActionScript language.
Also, do not use any word in the ActionScript 2.0 languages (called a language construct) as an
instance or variable name. ActionScript constructs include class names, component class
names, method and property names, and interface names.
Never use different cases to avoid conflicting with reserved words. For example, naming
an instance of the
because Flash is case-sensitive) is a poor coding practice.
734
Best Practices and Coding Conventions for ActionScript 2.0
method instead of the less descriptive
TextField class (which doesn't conflict with TextField
textfield
rather than
myPelican
.
addUser
method. This
getData()

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