Flash Components      Flash Menu      Flash Gallery      Flash Slideshow      FLV Player      Flash Form      MP3 Player      PhotoFlow      Flash CMS      3D Wall      Flash Scroller

Flash / AS



ASP.net / PHP






  Design & Effects
  Audio & Video
  User Interface



Naming Conventions
       by ilyas usal | 27 December 2005

The naming scheme of your movie is very important for readability purposes. I mean that the type of the entity you are referring to should be obvious just by looking at its name. Your best bet then is to make your names phrases, or at least a series of words. Here's how I usually proceed:

  • Movie name: my_movie_that_does_stuff.swf
    I use a nice little sentence, everything lower case, with words separated by underscores. Keeping track of what a movie contains is not an easy thing, and giving them names like test01_b.swf will NOT help you to figure it out.
  • Function name: doSomething()
    Function names usually begin with a lower case letter. It is very common for programmers to put a verb followed by a noun (first letter upper case). So if your function is supposed to get the position of a clip, it would be a good idea to call it getPosition(). You'll notice that this is how Macromedia named its own functions (startDrag, swapDepths, nextFrame).
  • Object name: DaObject
    Objects are capitalized. So are constructors. Instances of a class, on the other hand, begin with a lower case letter.
MyClass=function(){}; // constructor
aClass=new MyClass(); // instance
  • Constant name: MAXCLIP
    It is common practice to put constant names all upper case. Even if I never do it.
  • Variable name:
    Variable names are a tiny bit more complicated. I'll start by what they should not be, and then will see the best practices.
    1. Variable names should not be one of Flash reserved words: words that are part of the language (function names, function, if, while, for...), case, var, switch, MovieClip.... I don't know the whole list, but if a variable name turns blue, it's usually not a good sign.
    2. They should not begin with a number.

    8count=0; // forbidden

    1. Variables beginning with an underscore are usually object properties, so it's not a good idea to give your variables names like _count.

    Now what you should do. This is not really critical, as Flash is not a strongly typed language, but it's better to precise the type anyway, one way or another.

    1. First way: use a prefix
      If you have a movie clip of a line, call it mcLine. If it's an input string, make it sInput, an array of points aPoints and so on for the other types (textfield, date, sound, XML, color).
    2. Second way: use a suffix
      With the same examples, you'd have something like that: line_mc, input_str, points_arr

There. That's about all I can think about. Once again, you don't HAVE TO use all this, but if you do, your code will be easier to read for everybody.

- pom


kirupa.com's fast and reliable hosting provided by Media Temple. flash components
The Text Animation Component for Flash CS3
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.
Check out our high quality vector-based design packs! Flash Effect Components
flash menus, buttons and components Digicrafts Components
The best flash components ever! Entheos Flash Website Templates
Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com Purchase & Download Flash Components
flash components Free Website | Make a Website
Streamsolutions Content Delivery Networks Learn how to advertise on kirupa.com