Thursday, January 31, 2013

ActionScript Dollar Sign Character in Variables

I recently came across some 3rd party ActionScript code that used the dollar sign ($) in argument variable names.  At first I thought it was a way of using the same variable name as a classes member variable, because the functions argument name appeared to be the same as one of the member variable names.  It turns out the $ just like the _ is one of the only valid non alpha-numeric characters that can be used for variable names.  So the $ wasn't some special modifier, but instead it was just a different way of naming the variable.  An important thing to note is that ECMA recommends the dollar sign only be used for generated code.