Daniel Dura

All About the Adobe Flash Platform

Flash Naming Conventions

with 16 comments

If you do not user the provided suffixes in your ActionScript, you should. If you want to see why, read this entry by Sean Voisen. He also gives suggestions on how you can modify the Flash MX configuration files so that they better meet your own personal coding conventions. I just thought that I would put together a complete list of all the standard suffixes, for quick reference.

When creating a large and complex application, with many custom components, I will usually give the components thier own suffixes and documentation, which helps me to keep my code clean and organized and prevents me from mistyping a method name, etc. But, with the growing number of components, it is becoming easier to create a conflict in the suffixes used. So, I put together this quick list, and thought I would provide it to you. If you have any suggestions, or additions, please post them in the comments. I can assure you that I missed out on a couple :)

http://www.danieldura.com/quickref.htm

Written by Daniel Dura

May 18th, 2003 at 10:03 am

Posted in Uncategorized

16 Responses to 'Flash Naming Conventions'

Subscribe to comments with RSS or TrackBack to 'Flash Naming Conventions'.

  1. Though i started using praefixes recently, i think it makes the code harder to read and to change. To minimize the bad effect on readability at least, i use the shortest possible praefixes:

    i int
    s string
    f function
    n number
    o object

    Additionaly i use p, if it is a parameter of a function, eg.

    function bokel( psName, piAge)

    In terms of readability it would be better to have an editor, which colors different types of variables. Or pops up a little window, if we need to know the type.

    Regards,
    bokel

    bokel

    18 May 03 at 10:51 am

  2. Great tip bokel. Although, I must say that i quite enjoy the underscore syntax. I have always found it quite easy to read through the code when using it. But, I guess it all comes down to personal preference :) By the way, you run a very informative and interesting blog, keep up the great work. (I just added it to flogspot).

    Daniel Dura

    18 May 03 at 11:04 am

  3. I’m a prefix person too, due to habit in other languages. I’m not really sure why they chose to do suffixes with MX, since prefixes seem to be the standard for coding.

    I’m also a fan of keeping it as short as possible. I like to be able to look at a variable and know that it’s a string variable (sName) or a movie clip (mcSomething), but without overloading the senses :)

    mike j

    18 May 03 at 4:12 pm

  4. thanks for the list!

    looks like you’re missing the LoadVars object. I use: ‘_lv’ for that, but no code hints come up :-(

    also, check out the MM whitepaper on actionscripting standards:

    http://www.macromedia.com/desdev/mx/flash/whitepapers/actionscript_standards.pdf

    michael e. gunn

    18 May 03 at 4:53 pm

  5. Personally I really don’t like the _mc convention for MovieClips. With all my code, I give all MovieClips a capital letter, like “NameOfThing”. All variables are given lowercase letters, like “blahDeBlah”.

    Then you get into Flash MX territory with Button instance names, but again, I think you can use capital letters at the start.

    It really helps in the code as you can tell at-a-glance what is a MovieClip:

    MyThing.thing is a variable inside a MovieClip, whereas myThing.thing is a variable inside an object.

    The most important thing though, is that you keep to a convention, whatever it is.

    Paul Neave

    19 May 03 at 5:45 am

  6. jest a test

    9 Mar 04 at 2:02 pm

  7. bbburrry

    vor

    13 Mar 04 at 8:09 am

  8. At this point in life, I find it hard to dwell on such insignificant happenings. I find it better to ignore the foolishness and keep moving.

  9. Online Flexeril, flexerilis used to treat the pain and stiffness of muscle injuries, including strains, sprains and muscle spasms.Buy Flexeril, Cheap Flexeril Now or visit this site: http://www.online-flexeril.com!

    flexeril

    17 Apr 04 at 6:23 am

  10. Hi from Katrina Eva cool amazing this page

  11. Hi from Katrina Eva cool amazing this page

  12. Dating and picture personal dating ads services for singles looking for love, romance, dating dates pen pals or relationships. Personals for the online dating and singles community. Post Your Free Dating, Singles, Picture Personal ads today. Visit us to chat with singles, look through personals, and read up on all the hilarious and heart-rending tribulations of dating service and romance today. http://www.dating-free-dating.com

    dating

    11 May 04 at 7:02 am

  13. hello

    jeff

    28 Jun 04 at 12:13 pm

  14. It’s so LAME to spam useful ressources with shit like hair/erection miracle products, which NOBODY wil EVER BUY !!!

    Fard

    12 Oct 04 at 8:05 am

  15. Chris Patterson

    12 Feb 05 at 2:35 am

Leave a Reply