我有这个按钮:
<s:Button includeIn="MeniuPrincipal" label="Descarcare Date" click="downloadLmData(event)"/>
和点击事件处理程序:
protected function downloadLmData(event:MouseEvent):void
{
downloadData('competenta', 'competente');
downloadData('localitate', 'localitati');
}
downloadData函数如下所示:
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);
}
}
问题是,除了第一个调用之外,所有调用都被忽略。是否有任何“排队”机制允许进行所有呼叫?
谢谢。
答案 0 :(得分:1)
您需要链接异步调用。有关实施,请参阅以下2篇博文:
http://kuwamoto.org/2006/05/16/dealing-with-asynchronous-events-part-1/
http://kuwamoto.org/2006/05/16/dealing-with-asynchronous-events-part-2/
答案 1 :(得分:0)
我宁愿使用观察者模式。最简单的方法。