Loading XML Data: Event.COMPLETE listener : URLRequest « Network « Flash / Flex / ActionScript






Loading XML Data: Event.COMPLETE listener

 
package {
  import flash.display.*;
  import flash.events.*;
  import flash.net.*;

  public class XMLLoader extends Sprite {
    private var novel:XML;
    private var urlLoader:URLLoader;

    public function XMLLoader (  ) {
      var urlRequest:URLRequest = new URLRequest("novel.xml");
      urlLoader = new URLLoader(  );
      urlLoader.addEventListener(Event.COMPLETE, completeListener);
      urlLoader.load(urlRequest);
    }

    private function completeListener(e:Event):void {
      novel = new XML(urlLoader.data);
      trace(novel.toXMLString(  ));  
    }
  }
}

        








Related examples in the same category

1.Loading XML Data from External Sources
2.Add URLrequest to Loader
3.Loading a bitmap at runtime
4.Formatting text with an externally loaded style sheet
5.Starting the load operation
6.Adding an asset to the display list
7.Use FileReference to download file from a URL