I’m trying to load local XML files into an Air application. After a while the application is supposed to check to see if the file has been modified then reload it. When attempting to reload the file I am getting a cached version and not the most up to date.
I’ve tried two way to load the local XML.
var file:File = File.documentsDirectory.resolvePath(_path);
file.canonicalize();
if (file.exists) {
var stream:FileStream = new FileStream();
stream.open(file, FileMode.READ);
var data:String = stream.readMultiByte(stream.bytesAvailable,File.systemCharset);
stream.close();
_data = new XML(data);
}
and
var file:File = File.documentsDirectory.resolvePath(_path);
file.canonicalize();
if (file.exists) {
var request:URLRequest = new URLRequest(file.url);
var headers:Array = request.requestHeaders = new Array(
new URLRequestHeader("Cache-Control", "no-store"),
new URLRequestHeader("Pragma", "no-cache")
);
request.cacheResponse = false;
request.useCache = false;
_loader = new URLLoader();
_loader.addEventListener(Event.COMPLETE, loadHandler);
_loader.load(request);
}
No go. I also can’t apply a “cache buster” garbage query string to the end of the path as you would online since it will interpret it as part of the actual path and fail to load anything. What could do to get Air to ignore the previously loaded data?