Ask Gary: Variable Names
Submitted by rosenz on Wed, 01/09/2008 - 23:45.
Hi Gary,
I teach AS and have for some time been telling my students to append
suffixes such as _mc to movieClips, _btn to buttons, etc. This seems to
really make life easier when troubleshooting. I have to wonder if I'm
really out of the loop on this one because I don't see anyone else doing
that.
I teach AS and have for some time been telling my students to append
suffixes such as _mc to movieClips, _btn to buttons, etc. This seems to
really make life easier when troubleshooting. I have to wonder if I'm
really out of the loop on this one because I don't see anyone else doing
that.
In AS3 if you type your variables well, then you really don't need to use suffixes to help identify variables when troubleshooting. Furthermore, if you use descriptive names, then the problem goes away. For instance, if I was putting playing cards on the stage, I would place them all in a sprite and call the sprite "cardSprite".
While I'm not a huge fan of using fixed suffixes like "_mc" in variable names, I'm not against it either. Whatever makes it easier for you or your programming team to get the job done.
»
- Flash Game University Blog
- Login or register to post comments
Copyright Gary Rosenzweig
