2 Replies Latest reply on Apr 29, 2008 5:18 AM by FlexPrashant

    combo box data binding

    FlexPrashant Level 1
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
      xmlns="*" creationComplete="send_data()">

      <mx:HTTPService id="userRequest"
      url=" http://suse/websites/team/Mahendra/createseries.php"
      useProxy="false" result="results(event);"/>

      <mx:Script>
      <![CDATA[
      import mx.controls.Alert;
      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;
      [Bindable]
      public var arr:ArrayCollection;
      [Bindable]
      public var aray:Array;

      private function results(event:ResultEvent):void
      {
      arr = event.result.Mylog;
      //aray= arr.toArray();
      //Alert.show(arr.length.toString());
      Alert.show(arr.toString());

      }
      private function send_data():void {
      userRequest.send();
      }
      ]]>
      </mx:Script>



      <mx:ComboBox id="hello" dataProvider="{arr}" x="86" y="253" width="133" >
      </mx:ComboBox>


      </mx:Application>

      my php script returning me
      <?xml version="1.0" encoding="utf-8"?>
      <Mylog>

      <series>Convertible</series>
      </Mylog><Mylog>

      <series>Sedans</series>
      </Mylog><Mylog>

      <series>Sport</series>
      </Mylog>


      this is my code . I want to fill combobox with the all values of series
      please help me . Means bind the combo box with httpservice result
        • 1. Re: combo box data binding
          SujitG Level 2
          Hi,
          set the labelField of the ComboBox to "series" as show in the code below.

          Hope this helps.

          <mx:ComboBox id="hello" dataProvider="{arr}" labelField="series" x="86" y="253" width="133" >
          </mx:ComboBox>
          • 2. Re: combo box data binding
            FlexPrashant Level 1
            I have changed my php code it will return me this xml

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

            <product productId="1">
            <series>Convertible</series>
            </product>

            <product productId="2">
            <series>Sedans</series>
            </product>

            <product productId="3">
            <series>Sport</series>
            </product>

            </Mylog>


            then i have changed 2 place
            arr = event.result.Mylog.product;

            and yeah label field in combo

            Thanks