Henrik Andersson wrote:

> My definition of a global variable is:
> * One single value per application
> * Can be accessed by any code
>
> A public property only satisfies the second condition.

Again, I think we're talking about a purely semantic difference, not a
functional one. Actually, Taka has a point--AS3 may not have true
globals at all. I think he may be right, as long as we are using OOP.

Consider this, though. Creat a new .fla, put a dynamic text field on
stage, call it myText, then put this code in the first frame:

var greeting:String = "Hello. Am I global?";

myText.text = greeting
stop();

That's very AS2-ish code, but it works as an AS3 .fla. Is it a global?

But, to your point about one single value per application,
myObject.myPublicVar can have only one value. True, the class can be
instantiated many times, but a non-static variable doesn't have a
value until its class is instantiated.

Even with these conditions, when you start using namespaces, you can
have exactly the same variable in different name spaces. In that case,
you could have myClass.myStaticPublicVar in two or more name spaces.
That puts it in kind of the same category as public variables, doesn't
it?

A lot of us here came from Director, myself included, and we're used
to Lingo's concept of a global namespace. I've programmed in many
other languages--C, C++, COBOL, Forrtran, and others--and AS3 is the
first I've used that doesn't really have a global namespace.

Cordially,

Kerry Thompson
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to