Greg,
Thanks for the reply, that helps, but when I switched to
using an XMLList I could loop through no problem.
I've got it working to that point but still NOT working...
**sigh**
As soon as I call the next "PopTREF" (see below) function the
_previous_ Combobox's data gets wiped out.
This is so difficult I feel as though I must be missing
something conceptually with the way data operations work with Flex.
HTTPService+event messes with my head. It would be SO easy in PHP,
ASP, ASP.NET...etc...especially using techniques like dynamic SQL I
could code this in 10 lines. Just a simple call to a query function
to populate a dataset, then use the dataset to populate a
dropdown...what am I missing here??!?
I've got 53 comboboxes... I really don't want to code &
maintain 53 HTTPServices, 53 initiators, 53 result handlers and 53
error result handlers....................is that what I'm expected
to do in Flex?
Here's my code I'm using:
I do appreciate your help by the way...
====================================
private var httpSvc:HTTPService;
private var cboPop:ComboBox;
private var category:String;
private var result:Object;
private function init() : void {
// POP THE COMBOS
//Ethnicity
cboPop = cboStuEthnicity;
category="EthnicityCD";
PopTREF();
// Status
cboPop = cboStuStatus;
category="Enrolled";
PopTREF();
Alert.show('Welcome!');
}
public function PopTREF():void {
httpSvc = new HTTPService;
var params:Object = new Object();
params.tref_category=category;
httpSvc.clearResult(false);
httpSvc.url = "
http://mydomain.P_XML_LIST_TREF"; httpSvc.method = "GET";
httpSvc.resultFormat="e4x";
httpSvc.addEventListener("result", httpResult);
httpSvc.addEventListener("fault", httpFault);
httpSvc.send(params);
//Alert.show("Sent!");
}
public function httpResult(event:ResultEvent):void {
result = event.result;
//Do something with the result.
var thisXML:XMLList = XMLList(httpSvc.lastResult.category);
//txtOutput.text=thisXML;
//Alert.show(thisXML.length());
for ( var i:Number = 0 ; i < thisXML.length() ; i++ )
{
cboPop.dataProvider.addItem({label:thisXML
.UZVTREF_DESC.toString(), data:
thisXML.UZVTREF_CODE.toString()});
}
httpSvc.clearResult(false);
}
public function httpFault(event:FaultEvent):void {
var faultstring:String = event.fault.faultString;
Alert.show(faultstring);
}
Combo box looks like:
<mx:ComboBox id="cboStuStatus"
width="200"></mx:ComboBox>