Search code examples
flashnaming-conventionsactionscript-2movieclip

Is the "_" prefix reserved for MovieClip names?


Is it possible to use the "_" underscore prefix for your own MovieClip names? (AS2)

i.e. Can you name a created/attached MovieClip "_feature" or "_bug" ?

Typically this is reserved for internal properties like _x or _visible.


Solution

  • The "_" prefix has no technical significance - you can use it your own names for MovieClips, text fields, or any other variable or method you like.

    As a convention, it used to be common for the names of "built in" properties (like _x, _visible, etc.) to begin with an underbar, but they stopped doing this around v6 or v7, so many later properties (filters, transform for example) don't use it. Also, they've used (and still use I believe, in AS3) multiple underbars for internal names they don't want people to trip over (like __proto__).

    There also used to be a fairly widespread convention to prepend $ to properties or methods intended to be private, since declaring them to be private doesn't have any effect. You see this a lot in components.