Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flash - AJAX call

Tags:

ajax

flash

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,

like image 920
Ryan Smith Avatar asked Jun 25 '09 20:06

Ryan Smith


1 Answers

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);
}
like image 144
Alex Jillard Avatar answered Sep 28 '22 13:09

Alex Jillard