我有多个远程对象调用的问题。因此,首先我必须从服务器检索雇主 ID(使用 BlazeDS btw),其次我必须根据雇主 ID 为每个雇主请求并检索每个雇主的其他详细信息(每个雇主 ID 的另外 2 个远程对象调用)。因此,正如您所理解的,第三个远程对象调用将第二个的响应作为其参数,第二个将第一个的响应作为参数。
我的问题是,当我遍历第一个请求的响应时,它仅针对其最后一个元素而不是每个元素调用第二个远程对象。
这是我的视图代码:
<fx:Declarations>
<parsley:FastInject property="karBUS" type="{KarBUS}"/>
<s:CallResponder id="hastalariGetirResponder" result="hastalariGetirResponder_resultHandler(event)"/>
<s:CallResponder id="yatakOdaGetirResponder" result="yatakOdaGetirResponder_resultHandler(event)" fault="yatakOdaGetirResponder_faultHandler(event)"/>
<s:CallResponder id="hastaKartlariGetirResponder" result="hastaKartlariGetirResponder_resultHandler(event)"/>
<s:CallResponder id="hastaResimGetirResponder" result="hastaResimGetirResponder_resultHandler(event)"/>
<parsley:Configure />
</fx:Declarations>
<fx:Script>
<![CDATA[
[Inject(id="karBUS")]
public var karBUS:KarBUS;
protected function view1_creationCompleteHandler(event:FlexEvent):void
{
trace("Hastalarim View: persID:"+SessionClientData.prsnl.personelId+",servisID: " + SessionClientData.servisId);
hastalariGetirResponder.token = karBUS.getHastalarim(SessionClientData.prsnl.personelId,SessionClientData.servisId);
}
protected function hastalariGetirResponder_resultHandler(event:ResultEvent):void
{
hastalarim = hastalariGetirResponder.lastResult;
if(hastalarim.length == 0) {
this.addElement(txt_empty);
this.removeElement(busy_ind);
}
for(var i:int=0;i<hastalarim.length;i++){
kt = hastalarim.getItemAt(i) as Object;
vizitID = kt[6];
hastaTC = kt[3];
yatakOdaGetirResponder.token = karBUS.getYatakOdaNo(vizitID);
}
}
protected function yatakOdaGetirResponder_resultHandler(event:ResultEvent):void
{
yatakOda = yatakOdaGetirResponder.lastResult as Object;
hastaKartlariGetirResponder.token = karBUS.getHastaKarti(vizitID);
}
protected function hastaKartlariGetirResponder_resultHandler(event:ResultEvent):void
{
hastaTuru = hastaKartlariGetirResponder.lastResult as String;
hastaResimGetirResponder.token = karBUS.getHastaResim(hastaTC);
}
protected function hastaResimGetirResponder_resultHandler(event:ResultEvent):void
{
resim = hastaResimGetirResponder.lastResult as ByteArray;
dp=new ArrayCollection();
var yatak:String;
var oda:String;
var kat:String;
if(yatakOda == null){
yatak = "";
oda = "";
kat = "";
}else{
yatak = yatakOda[2];
oda = yatakOda[1];
kat = yatakOda[0];
}
for(var i:int=0;i<hastalarim.length;i++){
kt = hastalarim.getItemAt(i) as Object;
var dt:Date = kt[5] as Date;
var vizitT:String = dt.date + "-" + (dt.month+1) + "-" + dt.fullYear;
dp.addItem({hastaId:kt[0], adi:kt[1],soyadi:kt[2],tcKimlikNo:kt[3], resim: resim,
yasi:kt[4],katNo:kat,odaNo:oda,yatakNo:yatak,
vizitTarihi:vizitT,vizitId:kt[6],cinsiyeti:kt[7], hastaTuru:hastaTuru});
trace("OdaNO - Yatak NO: "+ oda + ", " + yatak);
}
}
]]>
</fx:Script>
如何让弹性线程等到前一个返回响应?任何线程处理方法?