6 Replies Latest reply on Feb 24, 2011 11:28 AM by Pablo Souza

    s:ComboBox Vrs mx:ComboBox

    PaddyMc2010

      Hi, i am currenly facing a problem when trying to create a combobox on a s:titlewindow.  When i use the spark combo box it will not display anything however the mx Combobox will display as expeted.  Could someone advise me on what i am doing wrong or how i might be able to get around this?

       

      I have the below XMLList via a HTTP Service

       

      [Bindable] public var testSourceData:XMLList

       

      private function rGettestData(evt:ResultEvent):void {

      testSourceData = evt.result.r;}

       

      <

       

      mx:HTTPService

       

      id="hsSourceData" method="GET" resultFormat="e4x"

       

      result="rGettestData(event)"

       

      fault="fault(event)"

       

      useProxy="false"

       

      </mx:HTTPService>

       

       

      <mx:ComboBox id="cbSource" width="150" dataProvider="{testSourceData}"   labelField="description"/>  ----Works Fine

       

      <s:ComboBox id="cbSource" width="150" dataProvider="{xmlGetSourceData}" labelField="description"/>  ----Does not display

       

       

      Thanks

        • 1. Re: s:ComboBox Vrs mx:ComboBox
          Pablo Souza Level 3

          Have you typed wrong or the Spark combobox has a different provider?

           

           

          Regards,

          Pablo Souza

          • 2. Re: s:ComboBox Vrs mx:ComboBox
            Pablo Souza Level 3

            I'm not sure if I fully understood your problem but take a look at this code, I believe it can help you:

             

            <?xml version="1.0" encoding="utf-8"?>
            <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                           xmlns:s="library://ns.adobe.com/flex/spark" 
                           xmlns:mx="library://ns.adobe.com/flex/mx"
                           creationComplete="srv.send();">
                <fx:Declarations>
                    <mx:HTTPService 
                        id="srv" 
                        rl="http://aspexamples.adobe.com/chart_examples/expenses-xml.aspx"/>
                </fx:Declarations>
                
                <s:VGroup width="100%" height="100%" horizontalAlign="center">
                    <mx:ComboBox width="150" dataProvider="{srv.lastResult.data.result}" 
                                labelField="month"/> 
                    <s:ComboBox width="150" dataProvider="{srv.lastResult.data.result}" 
                                labelField="month"/>
                </s:VGroup>
            </s:Application>
            

             

            Best regards,

            Pablo Souza

            • 3. Re: s:ComboBox Vrs mx:ComboBox
              PaddyMc2010 Level 1

              Paulo thanks for your response.

               

              Essentially my problem is when i use

               

              <s

               

              :ComboBox id="cbSourceName" width="150" dataProvider="{testData}" labelField="description" />

               

              My Combo box is blank with nothing in the dropdown.

               

              However

               

              When i use below mx:ComboBox this is fine and all is populated as expected.  Same XML List, same dataprovider, same httpe service etc.

               

              <mx:ComboBox id="cbSourceName" width="150" dataProvider="{testData}" labelField="description" />

               

              I am at a loss as to why this is not working.  I am thinking it must be some sort of XML issue perhaps although i dont no.  I guess i will just have to use the mx:ComboBOx for now until i can figure out why no data is populating.

              • 4. Re: s:ComboBox Vrs mx:ComboBox
                Pablo Souza Level 3

                Hi,

                 

                If you are only listing the data from dataprovider, you can use the Spark DropDownList control instead of the ComboBox control.

                 

                 

                Regards,

                Pablo Souza

                • 5. Re: s:ComboBox Vrs mx:ComboBox
                  PaddyMc2010 Level 1

                  Pablo many thanks for your responses.

                   

                  It turns out this issue was due to fact as i had my xml in xmlList not xmlListCollection.

                   

                  Thanks

                   

                  Again

                  • 6. Re: s:ComboBox Vrs mx:ComboBox
                    Pablo Souza Level 3

                    Ok, great!