# Confused on main document class

**URL:** <https://forum.kirupa.com/t/confused-on-main-document-class/267271>\
**Category:** flash\
**Created:** [July 30, 2008, 8:36am UTC](https://forum.kirupa.com/t/confused-on-main-document-class/267271 "2008-07-30T08:36:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tibberous](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@tibberous](https://forum.kirupa.com/u/tibberous)\
**Post date:** [July 30, 2008, 8:36am UTC](https://forum.kirupa.com/t/confused-on-main-document-class/267271/1 "2008-07-30T08:36:33Z")

</div>

I have a document class, exp.as. In it is the normal:

```php

package {
 import flash.display.MovieClip;

 public class exp extends MovieClip{
  
 }
}

```

And in it, I define a function:

public function t(){

}

Now, in the main frame, I can do -

this.t();

and t();

But I can’t do exp.t() or root.t();

The problem is, once I get inside another class, ‘this’ referrers to something different and t() is undefined. The only way I know to get around this is to either:

1. Make everything static
2. Create a static variable in the main class to hold the non-static instance of the object

Both of those ways work, but I can’t imagine that either is the correct way… or maybe #1 is the correct way, which is to say that I was able to structure a whole application using completely static references to everything. Isn’t their just a global variable that holds a non-static instance to the main document?
