It's not a global because if you have a MovieClip called testMC on the stage
and are inside testMC and try to do trace(greeting), you will get an error.

To access that property you have to do parent.greeting, therefore because
you have to be aware of the scope to access it, it is not "global".

On Wed, Aug 4, 2010 at 2:30 PM, Kerry Thompson <[email protected]>wrote:

> 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
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to