0

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 must 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);
}
Yi Jiang
  • 49,435
  • 16
  • 136
  • 136
ghiebert
  • 1
  • 1

2 Answers2

1

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.

TCM
  • 16,780
  • 43
  • 156
  • 254
  • Tried that, therefore it's not caching. It must be concurrency, the time I load these is too close too each other??? When I created a new instance of httpservice, slightly different name, I was able to load a second XML file and the data was as it should be. I believe I should be using the TAG version of httpservice, which I don't know how to do yet, so back to the books. From what I understand, the mx tag version has concurrency capability. If anybody can shed further light, please feel free, and let me know if I am right. – ghiebert Jan 24 '11 at 14:37
  • even if it's very close i believe milliseconds will obviously differ. Won't it? What are you trying to do? Make 1000 request / millisecond? – TCM Jan 25 '11 at 18:00
  • Oh no, not milliseconds. I thought the same thing so instead of next to each other during the init sequence, I load the 2nd xml file manually. Same result. If it is true that Firefox normally does not display this quirk, then this is a bug, perhaps Flex 4 is fixed. I am going some other route for the moment. I have wasted too much time on it. – ghiebert Jan 26 '11 at 04:53
0

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);
}
thejartender
  • 9,339
  • 6
  • 34
  • 51