According to the Adobe Flex forum and Peter Ent of Adobe, I should 
use an XMLListCollection. Being simple-minded myself, I like simple 
things and hoped that an ArrayCollection and ComboBox would work. It 
seems to be a common example in Adobe docs (but fails when there is 
only 1 node of content which should give you 1 and only 1 item in 
your ComboBox). 

The XMLListCollection works fine when there is only 1 node of content 
in my source XML. However, I need to process the XML to get 
the "data" part of the ComboBox. 

I realize that I am not doing a good job explaining this. Please 
refer to the Adobe forum: 
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?
forumid=60&catid=585&threadid=1198525&highlight_key=y&keyword1=combobo
x


--- In [email protected], "pdenys" <[EMAIL PROTECTED]> wrote:
>
> Thanks for your reply. That did not work as "state" is the 
repeating 
> element not "states". If there are more than 1 "state" then this 
> works fine. I don't understand why 1 element would give the 
ComboBox 
> trouble.
> 
> --- In [email protected], "Hilary Bridel" <hblists@> 
> wrote:
> >
> > Hi,
> > Try changing:
> > 
> > myAC = event.result.states.state;
> > 
> > to
> > 
> > myAC = event.result.states;
> > 
> > Hilary
> > 
> > --
> > 
> > On 13 Mar 2007 19:36:50 -0700, pdenys <pdenys@> wrote:
> > >
> > >   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>
> > >
> > > 
> > >
> > 
> > 
> > 
> > -- 
> > Hilary
> > 
> > --
> >
>


Reply via email to