Okey, this is pretty weird…
I’ve been taught that when you have a private variable in a class it can’t be accessed, let alone be altered, outside of the class. So how come I can do the mentioned actions on an objects private variables within a fla?
class:
class myClass {
private var foo;
function myClass() {
foo = "top secret";
}
}
fla:
obj = new myClass();
trace(obj.foo);
obj.foo = "hello"
trace(obj.foo);
That’s a static var you’re talking about.
But a private var just shouldn’t be able to get altered.
Not by an instance of the class, nor by anything other then the class’s methods.
From the subforum “Flash 2004 Pro”:
Private vars are also accessible from subclasses.
Private vars and functions can be accessed from the class itself, or subclasses. You can even make a private var public from a subclass.
I guess subclasses are those that are extended from the original class?
That’s normal, but I’m still in the dark about the calling from within a normal fla :S