Flash - AJAX call

ajax, flash

Solution

All you need to do is use a URLLoader.

var urlRequest:URLRequest= new URLRequest("http://example.com/page/");
_urlLoader = new URLLoader();
_urlLoader.addEventListener(Event.COMPLETE, onXMLDataLoaded, false, 0, true);
_urlLoader.load(urlRequest);


function onXMLDataLoaded(evt:Event):void {      
    var xml = new XML(_urlLoader.data);
}

Problem

I want to call a web page from Flash and use the data returned from it (either in plain text or XML). I see with the NetConnection you can connect to a web service, but I just want to call a plain old web page. It seems like I managed to do this a while back, but for the life of me, I can't find the answer on the web. Does anyone know what the function / code is to call a web page in Flash and get the data back? Thanks,

Original source