title: How do I reference a class instance from another class instance in Actionscript 3.0?
body: <p>Quick question. I have been Googling this all morning, but it's either not there, or else written in a way that doesn't register. I am inclined to believe the latter, as this seems like it should be something completely trivial to me.</p>
  
  <p>I made a small Flash file using AS 3.0, and this is the first time I've really been able to stick to the OOP way of doing things and not hack together a mix of stuff from the timeline to get around not having everything work in the classes.</p>
  
  <p>So I'd like to keep it that way, but one thing is eluding me: I can't call a method of an instance of another class (than the one I'm calling from) without resorting to "DocumentClass(root).instanceName.method."</p>
  
  <p>Intuition tells me there has to be a better way of doing this (like, without having to reference the document class every time I call another class instance's function; and CERTAINLY without having to use the word "root" - that just seems so Flash 5 to me.</p>
  
  <p>Does anybody have a better way of doing this that they can share?</p>
  
  <p>Thanks in advance! SS</p>
  
  <p>edit: Here's some relevant code:
  Main class:</p>
  
  <pre><code>package myApp {
  
      import flash.display.*;
      import flash.events.*;
  
      public class Main extends flash.display.MovieClip {
  
          public var background;
  
          public var control;
  
          public function Main() {
  
              //load the background
              this.background = new Background();
              this.addChild(background);
  
              //load the control
              this.control = new Control;
              this.addChild(control);
          }
      }
  }
  </code></pre>
  
  <p>Background class:</p>
  
  <pre><code>package myApp {
  
      import flash.display.*;
      import flash.events.*;
  
      public class Background extends flash.display.MovieClip {
  
          public function Background() {
              this.x = 0;
              this.y = 0;
          }
  
          public function doSomething() {
              //do something here
          }
  
      }
  }
  </code></pre>
  
  <p>Control class:</p>
  
  <pre><code>package myApp {
  
      import flash.display.*;
      import flash.events.*;
  
      public class Control extends flash.display.MovieClip {
  
          private var section01;
          private var section02;
          private var section03;
  
          public function Control() {
  
              //some constructor code here
  
          }
  
          public function doSomethingCaller() {
              MyApp(root).background.doSomething();   &lt;--- HERE
          }
      }
  }
  </code></pre>