flex的httpservice返回的值有时候完整有时候不完整,急死了
我使用的是flex+.net,使用httpservice进行交互,使用的是flexviewer,我在同一个页面中使用了两个httpservice服务,一个是在地图上创建图表,一个是在窗体中创建图表,但是获取的数据有时候完整,有时候不完整,是怎么回事啊?
关键代码如下
private function init():void{
if(configXML){
selectedType=configXML.SelectType;
selectedID=configXML.SelectType.@ID;
GetData("2008",selectedID);
GetDtByYear("2008");
}
private function GetData(oVar1:String,oTypeId:String):void{
httpService = new HTTPService();
var temUrl:String=GetValueByID("byparent",configXML.urls);
if(oVar1!="" && oTypeId!="-1"){
httpService.url=temUrl+"?year="+oVar1+"&type="+oTypeId;
}else{
httpService.url=temUrl+"?year=2008&type=1";
}
httpService.method="POST";
httpService.resultFormat="e4x";
httpService.requestTimeout = 10;
httpService.addEventListener(ResultEvent.RESULT,resultHandler);
httpService.send();
}
private function resultHandler(event:ResultEvent):void{
this.graphicsLayerId.clear();
var xmlResult:XML=event.result as XML;
for each(var xml:XML in configXML.Areas.children()){
var point:MapPoint=new MapPoint(Number(xml.@xcoord),Number(xml.@ycoord));
var grap:Graphic=new Graphic(point);
grap.attributes=new Object();
var thematic:ArrayCollection=getCollection(xml.toString(),xmlResult);
grap.attributes.thematic=thematic;
this.graphicsLayerId.add(grap);
}
}
private function GetDtByYear(tempYear:String):void{
var tempType:String=cmblineType.selectedLabel;
var tpID:String=getTheID(tempType,configXML.Types);
var tempUrl:String=GetValueByID("area",configXML.urls)+"?year="+tempYear+"&typeId="+tpID;
GetChartData(tempUrl);
}
private function GetChartData(ourl:String):void{
httpService = new HTTPService();
httpService.url=ourl;
httpService.method="POST";
httpService.resultFormat="e4x";
httpService.requestTimeout = 10;
httpService.addEventListener(ResultEvent.RESULT,resultClick);
httpService.send();
}
private function resultClick(event:ResultEvent):void{
var resultXML:XML=event.result as XML;
var collectionArr:ArrayCollection=new ArrayCollection();
for each(var tempXML:XML in resultXML.children()){
collectionArr.addItem(tempXML);
}
//绑定数据
lineChart.dataProvider=collectionArr;
clmChartId.dataProvider=collectionArr;
}