URL Loader class in Air application not returning

2019-09-15 17:36发布

问题:

I am using the class URLLoader in my air application and if i used parameters in url , flex showing an error #2032. if the same code used in web application, that is running in web browser, returning proper results. I didn't get a proper solution yet. Is there any way to return results in my air application? I used a web debugger fiddler, to check whether data is returning from server or not. Data is returning properly from the server, but it is not showing in air application.

here is the way i used the url-

urlLoader=new URLLoader(new URLRequest('http://exaple.com?year=2012'));

回答1:

If you paid some attention to the documentation ( who does that anyway?! ) you'd see that the constructor to URLLoader takes a URLRequest

I generally use the URLLoader as follows:

var urlRequest:URLRequest = new URLRequest('http://example.com?year=2012');
var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.TEXT; // default
urlLoader.addEventListener(Event.COMPLETE, urlLoader_complete);
urlLoader.load(urlRequest);

function urlLoader_complete(evt:Event):void {   
    trace(urlLoader.data);
}

Also check that a firewall isn't blocking your adl.exe process.