URL Loader class in Air application not returning results

假装没事ソ 提交于 2019-12-13 06:31:18

问题


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.



来源:https://stackoverflow.com/questions/12913792/url-loader-class-in-air-application-not-returning-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!