Monday, April 03, 2006

Flash Naming Conventions

Hello!

Remember how Karl taught us to name the symbols in our Library according to what type they are:
"g_ball" for a graphic, for example, or "m_car" for a movie.

Well, Flash 8.0 has code hints for instances of objects for when you're writing actionscripts. For
example, if you're writing some script for a button instance you've named "play_btn", when you're
typing a script and you hit the dot to give you "play_btn." you get a drop-down list of properties and
methods to choose from, which is extremely helpful.

The code hints are set to work with a set list of suffixes. If you've got a button whose name ends
in "_btn", then the code hints for buttons will drop down while you're typing the script. I'm trying to
get into the habit now of naming all instances using the correct suffix, for help when I'm
scripting. Here's the list.

OBJECT 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
NetConnection _nc
NetStream _ns
PrintJob _pj
SharedObject _so
Sound _sound
String _str
TextField _txt
TextFormat _fmt
Video _video
XML _xml
XMLNode _xmlnode
XMLSocket _xmlsocket

Hope this is useful.

0 Comments:

Post a Comment

<< Home