Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
garag #1
Combo box populate from xml
Hi.
Is it possible to publish an example that shows how populate a combobox with a
xml file?
For example, if you have this xml:
var sample : XML =
<Values>
<Value>
<Label>20 per page</Label>
<NumberPerPage>20</NumberPerPage>
</Value>
<Value>
<Label>50 per page</Label>
<NumberPerPage>50</NumberPerPage>
</Value>
<Value>
<Label>100 per page</Label>
<NumberPerPage>100</NumberPerPage>
</Value>
</Values>;
What is the right code to show in the combo the values of all the node "Label"?
The following doesn't work
combo.dataProvider = sample.Values.Value.Label;
Thank you
Regards
garag Guest
-
How to populate a DataProvider with XML and AS only
Hi there, after having spent 2 hours, I decided to get some help from you. Here's what I'd like to do. I have an XML file that I'd like to... -
Populate Combo box with value 'ALL'
Have read in a query to a combo box but need to have an additional value of ALL in the combo box to enable our filter to work. How can i do this,... -
Populate Text Box
I have a form with a drop box and some text boxes(Fname, Lname, M). A drop box is displayed all name from the database with this format: lname,... -
Best way to populate a <SELECT>
Hi All I've being doing it my own little way for sometime now, but I'm not sure if its the best. When I'm doing a recordset for a simple... -
populate combo in asp
Can someone please tell me what they think is wrong with this code to populate a combo : <select name="select"> <% While ((Repeat1__numRows <>... -
Xyrer #2
Re: Combo box populate from xml
I think you will find this very useful:
[url]http://thanksmister.com/xmlcombo/index.html[/url]
I hope this solves your problem.
Best regards.
Xyrer Guest
-
VarioPegged #3
Re: Combo box populate from xml
This should get you started. Check the docs for more samples.
TS
<?xml version="1.0" encoding="UTF-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="init()">
<mx:Script>
<![CDATA[
private function init() : void {
var sample:XML =
<Values>
<Value>
<Label>20 per page</Label>
<NumberPerPage>20</NumberPerPage>
</Value>
<Value>
<Label>50 per page</Label>
<NumberPerPage>50</NumberPerPage>
</Value>
<Value>
<Label>100 per page</Label>
<NumberPerPage>100</NumberPerPage>
</Value>
</Values>;
cb.dataProvider = sample.Value;
cb.labelField = "Label";
}
private function showValue(event:Event):void
{
ta.text += "You've selected " +
event.target.selectedItem.NumberPerPage.toString() + " items per page. \n";
}
]]>
</mx:Script>
<mx:ComboBox id="cb" close="showValue(event)" prompt="Select number per
page"/>
<mx:TextArea id="ta" width="300" height="200" />
</mx:Application>
VarioPegged Guest
-
garag #4
Re: Combo box populate from xml
Hi guys,
thank you for your suggestions, they works.
I forget to write in my first post that I had also tried with:
combo.dataProvider = sample.Values.Value;
combo.labelField = "Label";
but it still didn't work because a XML variables already contains the root
node of the xml.
Many thanks
Regards,
garag Guest



Reply With Quote

