Hi All

 

Below is the xml file which I am using to populate combo box

 

<?xml version="1.0" encoding="UTF-8"?>

<root>

    <row>

        <id>1</id>

        <name>q</name>

    </row>

   

    <row>

        <id>3</id>

        <name>w</name>

    </row>

   

    <row>

        <id>4</id>

        <name>a</name>

    </row>

   

    <row>

        <id>5</id>

        <name>s</name>

    </row>

   

    <row>

        <id>6</id>

        <name>d</name>

    </row>

</root>

 

below is the code for mxml in which I am using http request to fetch data. below code is returning me only object.

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="w1.send();">

      <mx:HTTPService id="w1" url="" result="pass()" fault="fail()" resultFormat="text" />

            <mx:Script>

                  <![CDATA[

                        import mx.collections.ArrayCollection;

                        import mx.rpc.events.ResultEvent;

                        import mx.rpc.events.FaultEvent;

                        import mx.events.ResizeEvent;

                        import mx.controls.Alert;                      

                        [Bindable]

                        public var xData:XML;

                        [Bindable]

                        public var a:ArrayCollection =new ArrayCollection();

                        public function pass():void

                        {

                              xData=XML(w1.lastResult.toString());

                              for(var i:int=0;i<xData.children().length();i++)

                              {

                                    a.addItem([{label:xData.row.name[i], data:xData.row.id[i]}]);

                              }

                                    Alert.show(a.length.toString());

                        }

                        public function fail():void

                        {

                              Alert.show("1");

                        }

                  ]]>

            </mx:Script>

            <mx:ComboBox id="cmd" dataProvider="{a}"/>

</mx:Application>

 

 

What I want is to populate data name in combobox and on selecting any particular name it should return me the id of the selected name.

 

Thanks in  advance

Kumar

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to