# Class Communication through the Document Class?

**URL:** <https://forum.kirupa.com/t/class-communication-through-the-document-class/255157>\
**Category:** flash\
**Created:** [March 19, 2008, 5:24pm UTC](https://forum.kirupa.com/t/class-communication-through-the-document-class/255157 "2008-03-19T17:24:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![EthanG800cc](https://avatars.discourse-cdn.com/v4/letter/e/97f17d/32.png) [@EthanG800cc](https://forum.kirupa.com/u/EthanG800cc)\
**Post date:** [March 19, 2008, 5:24pm UTC](https://forum.kirupa.com/t/class-communication-through-the-document-class/255157/1 "2008-03-19T17:24:37Z")

</div>

Hello all. I’ve been running into the problem of classes, their variables, and how they are able to interact.

Example:  
I have a document class which instantiates two different classes, each with their own public variables. I can call these variables from the document class, but not from one class to the other.

Document class (generic test code)

```auto

var test01:MyClass = new MyClass();
trace(test01.myVar) // outputs: "This is your FIRST test string"

var test02:MyNewClass = new MyNewClass();
trace(test02.myDifferentVar) //outputs: "This is your SECOND test string"

```

Now say I’m in, “MyClass”

```auto

// here I'm trying to reference an instance of "MyNewClass()" that is in my document class
trace(test02.myDifferentVar) // outputs: undefined

```

I was under the impression that I would have access to anything in my document class from anywhere in any other class. Is there a way of referencing to the document class, as in its instance name or something?

```auto

// here I'm trying to reference an instance of "MyNewClass()" that is in my document class
trace(*DocumentClass*.test02.myDifferentVar) // outputs: undefined

```

This is turning out to be a big problem, but I hope there is an easy fix for it. Does anyone have any suggestions?  
Thank you,  
-EthanG
