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( ));
}
}
}
|