XMLLoader Class - Accessing data

I made this simple xml loader class:

 import flash.net.*;
 import flash.display.Sprite;
 import flash.events.*;
 public class XMLLoader extends Sprite
  private var xml:XML;
  private var xmlLoader:URLLoader = new URLLoader();
  public var xmlList:XMLList;
  public function XMLLoader([url:String](http://www.kirupa.com/forum/String))
   xmlLoader.load(new URLRequest(url));
   xmlLoader.addEventListener(Event.COMPLETE, onComplete);
  private function onComplete(event:Event):void
   xml = XML(event.target.data);
   xmlList = xml.children();

Then in the main fla, after I import the class I write this:

var myXML:XMLLoader = new XMLLoader("file.xml");

the trace statement returns null because it is being called before the xml file is finished loading. When I put the trace call in the class file in the onComplete handler it works fine.

My question is this. How do I properly access the xml file after it is completely loaded from the main fla or another class? How do classes know when the files from other classes are done loading and ready to use?