Question

How can I get the content of a requested url, that returns an html-page, passed into a string, with java in flash actionscript. ?! I have this for now

var req:URLRequest = new URLRequest("http://somedomain.com/index.php");
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, handleVariables);
loader.load(req);

what do I have to write in the function handleVariables?!

Was it helpful?

Solution

The URLLoader.data property will contain the decoded variables in the form of an Object. One way to retrieve them would be the following:

function handleVariables(event:Event):void {
    var loader:URLLoader = event.target as URLLoader;
    for (var key:String in loader.data)
        trace(key, loader.data[key]);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top