Flash/Flex:Current Naming Conventions

Naming
The naming standards are mostly consistent with those of ECMAScript and Flash Player 9.

Abbreviations
Abbreviations are best avoided. However, some have been standardised and are generally acceptable:


 * acc for accessibility, as in
 * auto for automatic, as in
 * eval for evaluate, as in
 * impl for implementation, as in
 * info for information, as in
 * num for number of, as in
 * min for minimum, as in
 * max for maximum, as in
 * nav for navigation, as in
 * regexp for regular expression, as in
 * util for utility, as in

Acronyms
Various acronyms are common in Flash/Flex, such as AIR, CSS, HLOC, IME, MX, MXML, RPC, RSL, SWF, UI, UID, URL, WSDL, and XML.

An acronym is always all-uppercase or all-lowercase. The only time that all-lowercase is used is when the acronym is used by itself as an identifier, or at the beginning of an identifier, and the identifier should start with a lowercase letter.

Examples of identifiers with acronyms are,  ,  ,  , and.

Word boundaries
When an identifier contains multiple words, we use two ways of indicating word boundaries: intercaps (as in  or  ) and underscores (as in  ).

Type-specifying names
If you want to incorporate the type into the name, make it the last &#8220;word&#8221;. Don't use the old ActionScript 1 convention of concatenating abbreviated type suffixes such as  to indicate type. For example, name a border Shape,  , or  , but not.

Often, the best name for an object is simply the same as its type, with different casing:

File names
Start the names of include files for  metadata with an uppercase letter, use intercaps for subsequent words, and make the last word &#8220;Styles&#8221;: ,.

Style names
Start them with a lowercase letter and use intercaps for subsequent words:,.

Enumerated values for String properties
Start them with a lowercase letter and use intercaps for subsequent words:,  ,

Constant names
Use all uppercase letters with underscores between words:,.

Method names
Start them with a lowercase letter and use intercaps for subsequent words:,.

Method names should always be verbs.

Event handler names
Event handlers should be named by concatenating &#8220;Handler&#8221; to the type of the event:.

Argument names
Use  (not ,  , or  ) for the argument of every event handler:

Type declarations
Write a type annotation for every constant, variable, function argument, and function return value, even if the annotation is simply :* to indicate &#8220;no type&#8221;.

Use the narrowest type that is appropriate. For example, a loop index should be a, not a  , and certainly not an   or.

Use  for integers, even if they can't be negative. Use  only for RGB colors, bit masks, and other non-numeric values.

Resources
Coding Conventions - Adobe Open Source Wiki