Well, in the midst of the Flash interactive feature I’ve been working on, I decided it really was about time I set myself a naming convention to follow when writing Actionscript code. I’ve always been a bit haphazard about how I name things, which in the long run will make it difficult for someone else to understand or to re-use. I also need to remember to use descriptive names for things. This will make it much easier for someone else reading the code to understand what each thing is or what it is doing.
Anyway, this is probably a work in progress, but at least I’ve gotten started!
Read more here: Abobe ActionScript 2.0 Best Practices – Naming Conventions
So, here it is:
Classes
- Start with Uppercase
- Concatenate words, using mixed cases
class MyClass
Functions & Objects
- Start with lowercase
- Concatenate words, using mixed cases
function myFunction
Movie Clips
- Prefix with ‘mc’
- After prefix start with Uppercase
- Concatenate words, using mixed cases
mcMyMovieClip
Constants
- All uppercase
- Separate words should contain underscores
MY_CONSTANT
Number variables
- Prefix with ‘num’
- After prefix start with Uppercase
- Concatenate words, using mixed cases
numMyNumber
String variables
- Prefix with ’str’
- After prefix start with Uppercase
- Concatenate words, using mixed cases
strMyString
Arrays
- Prefix with ‘arr’
- After prefix start with Uppercase
- Concatenate words, using mixed cases
arrMyArray
Boolean expressions
- Prefix with ‘is’
- After prefix start with Uppercase
- Concatenate words, using mixed cases
isThisOn








Yay!
Your naming conventions are far more elegant than mine – I generally have no conventions at all in any code i write!