title: Need some help understanding use of package in AS3
body: <p>I'm just beginning to explore the use of packages. I would like the result of a function (as a variable "myXML") to be available to other elements of the code. And I'm wondering if creating a new class file is the way to go. For example:</p>
  
  <pre><code>package  
  {
      import flash.display.Sprite;
      import flash.events.Event;
      import flash.net.URLLoader;
      import flash.net.URLRequest;    
  
      public class XMLLoad 
      {
          public var myXML:XML;
          public var myLoader:URLLoader = new URLLoader();
          myLoader.load(new URLRequest("http://myWebsite/myFile.xml"));
          myLoader.addEventListener(Event.COMPLETE, processXML);
  
          public function processXML(e:Event):void 
          {
              myXML = new XML(e.target.data);
              trace(myXML);
          }
  
      }
  
  }
  </code></pre>
  
  <p>Is this a good way to create a global variable? If so, in the FLA file, how would I access/use the var "myXM" which holds the XML data?</p>
  
  <pre><code>import XMLLoad;
  XMLLoad();
  ?
  </code></pre>
  
  <p>Many thanks.</p>