Instance Names
Valid Instance Names
As we proceed with our work, you'll find working with instance names to be invaluable. You will not be able to control objects (MovieClips, Buttons, etc.) with ActionScript unless you can reference their instance name.
We'll continue to walk you through instance names as we animate with ActionScript. But should choose to strike out on your own, you should know the following rules:
-
Some Tips:
- Use descriptive names (names that describe the object)
- Use Letters, numbers, and underscores
- Pick a capitalizing scheme and stick with it (instance names are case sensitive)
-
Three GOOD Names:
- ball
- spaceShip
- enemy2
-
Do NOT:
- Begin instance names with numbers
- Use spaces
- Use ANY punctuation other than an underscore
- Use "reserved" names, which are already used by Flash
-
Three BAD names:
- 1ball (begins with a number)
- space ship (includes a space)
- enemy.2 (includes a period)
- play (reserved)
Keep it simple. You'll want to reference your instance names without making it too difficult on yourself.