ActionScript Naming Conventions

Notes:

ActionScript Naming Conventions | Naming Variables & Constants:

Ex:
Valid: s, p, Num, num, score, _flag, player9, $price, SCREEN_WIDTH, setWidth, Student etc.
Invalid: 9thplayer, _ _flag, $$balance, continue,while, try, etc.

1. Variable name and constant name should be meaningful and descriptive
2. Keywords should never be used as variable name or constant name
3. The first character can be an alphabet, underscore or dollar character
4. The first character should not be a number
5. All succeeding characters can be alphabets, digits, or underscores
6. No special characters are allowed except an underscore or dollar, not even space
7. More than one successive underscores or dollars should not be used
8. Variable names and constant names are case sensitive
9. White space is not allowed
10. Use Camel case naming convention for naming variables
i.e. if there is a single word in a variable name, then all characters should be in lower case letters, and if there are more than one words in a variable name, then first word’s all characters should be in lower case letters and all succeeding words first character should be in upper case letter, and all succeeding characters in all succeeding words should be in lowercase letters.
Ex: playerScore, player1Health, player2Health etc.
11. Whereas while naming a constant, all characters should be in upper case letters, if there are more than one word in a constant, then words should be separated by an underscore character.
Ex: SCREEN_WIDTH, SCREEN_HEGHT, PI etc.
12. No two variables or constants should have same name in the same scope
13. Always initialize a variable and constant, when they are declared