Instance names and code hinting – Tips & Tricks
Monday, March 2nd, 2009
When coding in actionscript sometimes it can be a pain that you don't get code hinting with objects that are on stage. A good way of overcoming this is to change the instance names of your objects (Movie Clips, Buttons, etc.) to have an underscore "_" then the abbreviated name of that object at the end of the name.
For example, you may have a movie clip on stage called myMovieClip. Change the instance name to have an _mc at the end (myMovieClip_mc), and now in your actions panel type myMovieClip_mc and press period. You will now see all the code hinting for a movie clip popup (see image). This can save a whole heap of time when coding.
Here is a list of the different shortcuts that you can use to bring up the code hinting. Some of these are for AS2 but the rest will work with AS3.
| Object type | Variable suffix |
|---|---|
| Array | _array |
| Button | _btn |
| Camera | _cam |
| Color | _color |
| ContextMenu | _cm |
| ContextMenuItem | _cmi |
| Date | _date |
| Error | _err |
| LoadVars | _lv |
| LocalConnection | _lc |
| Microphone | _mic |
| MovieClip | _mc |
| MovieClipLoader | _mcl |
| PrintJob | _pj |
| NetConnection | _nc |
| NetStream | _ns |
| SharedObject | _so |
| Sound | _sound |
| String | _str |
| TextField | _txt |
| TextFormat | _fmt |
| Video | _video |
| XML | _xml |
| XMLNode | _xmlnode |
| XMLSocket | _xmlsocket |
I find that using this technique saves me a whole heap of time when programming.

In the first meeting of