Reputation: 1067
I have this button:
<s:Button includeIn="MeniuPrincipal" label="Descarcare Date" click="downloadLmData(event)"/>
and this click event handler:
protected function downloadLmData(event:MouseEvent):void
{
downloadData('competenta', 'competente');
downloadData('localitate', 'localitati');
}
the downloadData function looks like this:
private function downloadData(item:String, items:String):void
{
try {
var colVar:String = 'col' + cappitalize(items);
this.status = "Descarcare date in curs...";
this[colVar] = null;
var service:HTTPService = new HTTPService();
service.url = serverUrl + items + '/xml';
service.resultFormat = "xml";
service.method = "GET";
service.addEventListener(ResultEvent.RESULT, addArguments(downloadDataComplete, [item, items]));
service.send();
} catch (error:Error) {
errorHandler.defaultErrorHandler(error);
}
}
The problem is, all calls are ignored, except for the first one. Is there any "queuing" mechanism which would allow all calls to be made?
Thank you.
Upvotes: 1
Views: 485
Reputation: 8875
You need to chain your asynchronous calls. See these 2 blog posts for implementations :
http://kuwamoto.org/2006/05/16/dealing-with-asynchronous-events-part-1/
http://kuwamoto.org/2006/05/16/dealing-with-asynchronous-events-part-2/
Upvotes: 1