This is my first CMS application and in the ackground is Delphi 7.
I use 5 different XMLListCollections which are dynamically loaded from local files on the server. HTTPService loads the first one into a DataGrid just fine, but when loading any subsequent XML file, it loads the same exact collection as before! I assume this mu开发者_StackOverflowst be a cache?
How do I turn off caching then when loading local XML files? I have tried some suggestions already, like involving headers and so on but nothing seems to deal directly with loading local files.
private function loadXMLData(urlVar:String):void
var httpService:HTTPService = new HTTPService();
httpService.url = urlVar;
httpService.resultFormat = "e4x";
httpService.addEventListener(FaultEvent.FAULT, httpService_fault);
httpService.addEventListener(ResultEvent.RESULT, httpService_result);
httpService.send();
}
private function httpService_fault(evt:FaultEvent):void {
var title:String = evt.type + " (" + evt.fault.faultCode + ")";
var text:String = evt.fault.faultString;
alert = Alert.show(text, title);
}
private function httpService_result(evt:ResultEvent):void {
var xmlList: XMLList;
xmlList = XML(evt.result).Events;
ArtistsData = new XMLListCollection(xmlList);
}
I am not quiet a Delphi or Flex guy. But the principles the same. What we do in C#/Silverlight is append a random query string at the end of the url.
So where you have url :-
httpService.url = urlVar;
you would want to do :-
httpService.url = urlVar + 'Date=' + currentdatetimealongwithmilliseconds;
This should definitely ignore the cache and make a new request.
Note :- As i said i am not a Flex guy, you need to convert the above line in your flex solution.
Whilst editing your code, I noticed a syntax error. The number of brackets don't match. I presume there should be a bracket where I have added and bolded one, using your code?
I don't know if this will resolve your issue, but eliminating anything that is erroneous in your code narrows down the problem.:
private function loadXMLData(urlVar:String) { // <== HERE?
var httpService:HTTPService = new HTTPService();
httpService.url = urlVar;
httpService.resultFormat = "e4x";
httpService.addEventListener(FaultEvent.FAULT, httpService_fault);
httpService.addEventListener(ResultEvent.RESULT, httpService_result);
httpService.send();
}
private function httpService_fault(evt:FaultEvent) {
var title:String = evt.type + "(" + evt.fault.faultCode + ")";
var text:String = evt.fault.faultString;
alert = Alert.show(text, title);
}
private function httpService_result(evt:ResultEvent) {
var xmlList: XMLList;
xmlList = XML(evt.result).Events;
ArtistsData = new XMLListCollection(xmlList);
}
精彩评论