Valid Names
When selecting a name for a symbol or other object follow these rules:
- A valid name must start with a letter of the alphabet.
- After the first letter, there can be additional letters, digits and underscores.
- There cannot be any spaces in a name.
- Words that have a special meaning such as play, stop, or width cannot be used as a name.
- A name should indicate its purpose. Names like symbol1, untitled, and single letters are not
good names.
- If two words are joined together (you can't have any spaces), a capital letter for the second
word or an underscore can improve the clarity. Example: hoursWorked, state_tax, and
dueDate are all good names.
- Remember, ActionScript is case sensitive. If an instance is named laserGun it must be written exactly the same way each time it is used. LaserGun, lasergun, and laserGun are all different names.
- When you create a movie clip, name the instance in the library with the first letter in upper case. Name the instance on the stage with the first letter in lower case.
- It will be easier to remember the names if you develop a particular style and stick to it. The examples here will usually use a lower case letter for the first word, and capitalize the first letter of the other words. (This style is sometimes called camel case.)
Determine if each name below is a valid variable name. Put the mouse over the check mark to see if you are right.
1. ball 
2. ball 1 
3. 1Fish 
4. bad_dude 
5. a123 
6. a1-b2 
7. x 
8. stop 
INDEX, What is ActionScript, Important Things to Remember, Naming Movie Clips, Stop!, Live demo of the ball stop movie, Stop Again!, Play!, Self Study Questions
Next lesson: Code Snippets