• Feedburner RSS
  • Comments RSS
  • Post RSS

Actionscript naming Conventions

April 17th, 2009

Everyone seems to know the feeling of being lost knee deep in a mess of code.

By using naming conventions you can help reduce the clutter….or at least organize your variables.

Here are some improvements that may help to keep your sanity.

1st Line: wrong way
2nd Line: right way

Numbers: use “num”

var thing:Number = 1;
var numThing:Number = 1;

Strings: use “str”

var thing:String = "hello";
var strThing:String = "hello";


Booleans: use “bol”

var thing:Boolean = true;
var bolThing:Boolean = true;

Arrays: use “arr”

var thing:Array = new Array();
var arrThing:Array = new Array();

Object: use “obj”

var thing:Object = new Object();
var objThing:Object = new Object();

MovieClips: use “mc”

var thing:MovieClip = new MovieClip();
var mcThing:MovieClip = new MovieClip();

Bitmaps: use “bmp”

var thing:Bitmap = new Bitmap();
var bmpThing:Bitmap = new Bitmap();

Obviously there are many more classes/etc but you get the idea. By always prefixing your variables you will narrow down the possibilities of creating an error…. or at least it does for me :)

Feel free to comment or make even better suggestions

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">