I have a simple example where my ComboBox has a dataProvider that is 
an ArrayCollection. This ArrayCollection is assigned to the results 
of an HTTPService that retrieves an xml file of US States. The XML 
file is just sitting on a local web server.

Why is it that when there is only 1 entry (State) in my XML file, the 
ComboBox does not populate correctly (it is blank)?

Here is my XML:
--------------
<?xml version="1.0" encoding="utf-8"?>
<states>

<state>
<label>MO</label>
<data>Jefferson City</data>
</state>

</states>

Here is my code:
---------------
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
        
<mx:HTTPService
        id="serviceTest"
        url="http://localhost:8080/states.xml";
        result="resultHandler(event)"
/>

<mx:ComboBox id="cmbTest" labelField="label" width="300" 
dataProvider="{myAC}"/> 
<mx:TextArea width="292" id="txtTest1"/>
<mx:TextArea width="290" id="txtTest2"/>
<mx:Button label="Feed from file" width="285" id="btnFeed" 
click="serviceTest.send()"/>

<mx:Script>
<![CDATA[
        import mx.collections.ArrayCollection;
        import mx.rpc.events.ResultEvent;

        [Bindable]
        public var myAC:ArrayCollection = new ArrayCollection();
        public function resultHandler(event:ResultEvent):void
        {
         myAC = event.result.states.state;
        }
]]>
</mx:Script>
</mx:Application>


Reply via email to