The following example shows how you can load a remote XML document in ActionScript 3.0 using the URLLoader class.
Full code after the jump.
// ActionScript 3.0 /** * Requires: * - TextArea control in the Library. */ import fl.controls.TextArea; var xml:XML; var urlRequest:URLRequest = new URLRequest("http://www.helpexamples.com/crossdomain.xml"); var urlLoader:URLLoader = new URLLoader(); urlLoader.addEventListener(Event.COMPLETE, urlLoader_complete); urlLoader.load(urlRequest); var textArea:TextArea = new TextArea(); textArea.move(5, 5); textArea.setSize(stage.stageWidth - 10, stage.stageHeight - 10); addChild(textArea); function urlLoader_complete(evt:Event):void { xml = new XML(evt.currentTarget.data); textArea.text = xml.toXMLString(); }
{ 1 comment… read it below or add one }
a clear example. thanks