Public variables, static or otherwise do NOT classify as global variables.

http://en.wikipedia.org/wiki/Global_variable

A global variable is something that is accessible everywhere without any
scope whatsoever.

By having to call MyClass.variable or myClassInstance.variable, it is quite
apparent that the property "variable" is not global, because you have to
explicitly call MyClass or a MyClass instance to access it.

Now, some developers might imitate global variables in AS3 by doing
something like making a class called Global, and accessing static variables
such as Global.variable1, Global.variable2, etc.

Taka

On Wed, Aug 4, 2010 at 11:15 AM, Kerry Thompson <al...@cyberiantiger.biz>wrote:

> Henrik Andersson wrote:
>
> > Public static properties are the only thing that can be compared with a
> > global. Note the word "static".
> >
> > And public is not the default, internal is.
>
> You're right, Henrick. Internal is the default, not public. My bad.
>
> I think we're splitting hairs on public vs. public static. A public
> variable, static or otherwise, is available to any caller.
> Technically, you are probably right, because a public variable isn't
> available until an object is intantiated from the class. A public
> static variable belongs to the class, not the instance, though, so it
> is available without instantiating an object. In fact, I use public
> static variables for my custom messages--I have a CustomMessage class
> specifically for that purpose.
>
> Nonetheless, once instantiated, and public variable is global whether
> it is static or not. That fits my concept of global.
>
> Cordially,
>
> Kerry Thompson
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to