Private var manupulatable from fla?

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 variable isn’t part of a class, it’s part of the object and the object has inherited the variable from the class.

what you can’t do is this:

myClass.foo = “hello”;

I think. hehe. maybe not.

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.

So how come you can from the fla?

hehe I dunno…

Senocular! Come here man! :wink:

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