package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
public class Main extends Sprite {
public function Main( ) {
var loader:URLLoader = new URLLoader( );
//loader.dataFormat = DataFormat.TEXT;
loader.addEventListener( Event.COMPLETE, handleComplete );
loader.load( new URLRequest( "example.xml" ) );
}
private function handleComplete( event:Event ):void {
try {
var example:XML = new XML( event.target.data );
trace( example );
} catch ( e:TypeError ) {
trace( "Could not parse text into XML" );
trace( e.message );
}
}
}
}
|