# Class Variable Scope

**URL:** <https://forum.kirupa.com/t/class-variable-scope/244461>\
**Category:** flash\
**Created:** [November 18, 2007, 3:32pm UTC](https://forum.kirupa.com/t/class-variable-scope/244461 "2007-11-18T15:32:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![boyceofreason](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@boyceofreason](https://forum.kirupa.com/u/boyceofreason)\
**Post date:** [November 18, 2007, 3:32pm UTC](https://forum.kirupa.com/t/class-variable-scope/244461/1 "2007-11-18T15:32:51Z")

</div>

I’m somewhat new to writing classes so forgive me if I get some wrong terminology.

I have a MC with a class attached to it, and I have other MCs within that MC. I need those MCs to be able to access variables within the main MC class. Here is a quick’n’dirty:

```auto

class Foo extends MovieClip{[INDENT]private var h:Number;
private var subMC:MovieClip;
[/INDENT][INDENT]function Foo(_h:Number){[INDENT]h = _h;
[/INDENT][/INDENT][INDENT]}

subMC.onEnterFrame = function(){[INDENT]trace(h);
[/INDENT]}
[/INDENT]}

```

How can I access variables in the Foo class from another MCs scope? I have tried using static var but aren’t they constant regardless of instance?
