# Private var manupulatable from fla?

**URL:** <https://forum.kirupa.com/t/private-var-manupulatable-from-fla/116905>\
**Category:** Uncategorized\
**Created:** [July 22, 2004, 12:25pm UTC](https://forum.kirupa.com/t/private-var-manupulatable-from-fla/116905 "2004-07-22T12:25:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mediamonkey](https://avatars.discourse-cdn.com/v4/letter/m/edb3f5/32.png) [@Mediamonkey](https://forum.kirupa.com/u/Mediamonkey)\
**Post date:** [July 22, 2004, 12:25pm UTC](https://forum.kirupa.com/t/private-var-manupulatable-from-fla/116905/1 "2004-07-22T12:25:11Z")

</div>

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:

```auto
class myClass {
    private var foo;
    
    function myClass() {
      foo = "top secret";
    }
  }

```

fla:

```auto
obj = new myClass();
  trace(obj.foo);
  obj.foo = "hello"
  trace(obj.foo);

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 22, 2004, 7:01pm UTC](https://forum.kirupa.com/t/private-var-manupulatable-from-fla/116905/2 "2004-07-22T19:01:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 23, 2004, 4:29pm UTC](https://forum.kirupa.com/t/private-var-manupulatable-from-fla/116905/3 "2004-07-23T16:29:50Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 23, 2004, 4:49pm UTC](https://forum.kirupa.com/t/private-var-manupulatable-from-fla/116905/4 "2004-07-23T16:49:10Z")

</div>

hehe I dunno…

Senocular! Come here man! 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 23, 2004, 4:59pm UTC](https://forum.kirupa.com/t/private-var-manupulatable-from-fla/116905/5 "2004-07-23T16:59:04Z")

</div>

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
