title: Passing variables between classes in Actionscript 3
body: <p>I'm not terribly good at this modern object coding lark and think I may have misunderstood how this is meant to to work: </p>
  
  <p>This is test.as in my Flash Builder 4.7 project called test</p>
  
  <pre><code>package
  {
  import flash.display.Sprite;
  
  public class test extends Sprite
  
  {
      public var myVar:int = 10;
      public function test() {
          var myTestsub:testsub = new testsub;
      }
     }
  }
  </code></pre>
  
  <p>And this is my testsub.as file:</p>
  
  <pre><code>package
  {
  public class testsub
  {
      public function testsub()
      {
          trace(myVar);
      }
    }
  }
  </code></pre>
  
  <p>Flash Builder tells me that in testsub.as "Possible access of undefined variable myVar" and will not compile. </p>
  
  <p>From my limited, and probably incorrect, understanding, making myVar public in test.as should allow testsub.as to use it. Can anyone explain where I am going wrong? Thank you in advance. </p>