Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cache problem in actionscript URLLoader

In one of my flash project i am getting xml data from the aspx file. But it always shows the same data and the new data is not coming in the request. I suspect the problem is in cache. Below is my code

var urlloader:URLLoader=new URLLoader();
var header:URLRequestHeader = new URLRequestHeader("Cache-Control", "no-cache");
var urlRequest:URLRequest=new URLRequest(serverPath +
                                         'GetScoreDetails.aspx?CardNo='+CardNo);
fscommand("LOG", serverPath + 'GetScoreDetails.aspx?CardNo=' + CardNo );
urlRequest.requestHeaders.push(header);
urlloader.addEventListener(Event.COMPLETE, loadedCompleteHandler);
urlloader.load(urlRequest);
like image 346
Saravanan I M Avatar asked Sep 21 '10 12:09

Saravanan I M


1 Answers

var xmlPath:String="replaceYourXMLPathHere.xml"
var urlReq:URLRequest = new URLRequest(xmlPath+"?time=" + new Date().getTime());

http://www.newtonflash.com/blog/2009/06/08/prevent-xml-caching-problem/#comment-43

like image 145
Saravanan I M Avatar answered Oct 15 '22 20:10

Saravanan I M