Problem with setting the xml dataprovider for combo box
I am trying to get the drop down list of combobox by using a php file. That php file returns an xml string which has been used as data provider for combobox.
I followed this thread too but in vain.
Details
I have set the creationComplete attribute of mx:Application to init(). In the init() function i have sent the following HTTPService<mx:HTTPService id="interfaces" url="interfaces.php" resultFormat="e4x" method="POST">
</mx:HTTPService>
Combo Box:
Update: The xml should look like
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<ifaces>
<iface>
<option>eth0</option>
</iface>
<iface>
<optio开发者_C百科n>eth1</option>
</iface>
</ifaces>
but if i execute interfaces.php in browser the only things that gets display is eth0eth1 whereas i am echoing the string that contains whole xml data. Shouldn't whole xml type of string display? :(
The problem is that ifaces is the root element of your XML, so interfaces.lastResult == ifaces. So the XMLList you want is interfaces.lastResult.iface.
This is a whole main class that works for me:
`<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" initialize="{interfaces.send();}">
<mx:HTTPService id="interfaces" url="interfaces.xml" resultFormat="e4x" method="POST"> </mx:HTTPService>
<mx:ComboBox dataProvider="{interfaces.lastResult.iface}" labelField="option"/>
</mx:Application>`
精彩评论