Global Variables vs. parameters
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Global Variables vs. parameters

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    26

    Question Global Variables vs. parameters

    I am working on a project, and I game across a guestion that had presented it self. I have a few variables that are used through out my project. As I have it wrote they are global variables, and it works ar wrote. However, I have heard global variable are not a good idea, except in certain instances. What I like to know is what everyone else thinks of global variables? Are they good or bad? Schould I rework my project to eliminate them? I am confident I can do this, but should I? One other thing. Does Flash have constants available? One or two of the global may work better as constants(ie. a website address). There may be pros and cons for each approach, what is the general approach? Thanks for you time. Troy

  2. #2
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    663
    think of this: what if you need to find your car keys in a box filled with lots of kids toys, socks and all kinds of useless things you have at home? that's how it looks like when you have many vars in one place (e.g. global scope). now, if the only things in that box are car keys, one toy car and one sock, finding keys in there is no-brainer - similarly, having all your vars global is not a problem if you only have so much of them.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com