title: Problems with accessing FlashVars via parameters in AS3
body: <p>I keep getting compiler errors when I try to access flashVars in an AS3 class.</p>
  
  <p>Here's a stripped version of the code:</p>
  
  <pre><code>package myPackage {
   import flash.display.Loader;
   import flash.display.LoaderInfo;
   import flash.display.Sprite;
    public class myClass {
      public function CTrafficHandler() {
          var myVar:String = LoaderInfo(this.root.loaderInfo).parameters.myFvar;}}}
  </code></pre>
  
  <p>And I get a compilation error:</p>
  
  <p><em>1119: Access of possibly undefined property root through a reference with static type source:myClass.</em></p>
  
  <p>When I change the class row to</p>
  
  <pre><code>public class myClass extends Sprite {
  </code></pre>
  
  <p>I don't get a compiler error, but I do get this in the output window:</p>
  
  <p><em>TypeError: Error #1009: Cannot access a property or method of a null object reference.</em></p>
  
  <p>Via the debugger (as suggested) I can see that <strong>this.root</strong> is null.</p>
  
  <p>How can I solve this problem?</p>