04JunActionScript Naming Conventions

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

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google

  1. 1 as3Conversion04 Jun 2009

    Yay! :)

  2. 2 mike18 Sep 2009

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

Leave a Reply

Spam protection by WP Captcha-Free




What I'm Doing...

Posting tweet...

Powered by Twitter Tools.

Blogroll

Recent Listening