2 Replies Latest reply on Jun 2, 2009 6:25 AM by BennyBeta

    Parse error at '<mx:dataProvider>'

    onthere

      Hello;

       

      i have a problem in my flex project.i'm using Flex3 but i use Flex2 for compiler...when i make a combobox like this:

       

          <mx:ComboBox itemRenderer="mx.controls.Label" width="236">
          <mx:dataProvider>
              <mx:Array>
                  <mx:Object label="1"/>
                  <mx:Object label="2"/>
              </mx:Array>
          </mx:dataProvider>
          </mx:ComboBox>

       

      i always have an error message like " Parse error at '<mx:dataProvider>'"

       

      can you help me for this????

       

      thank you...

        • 1. Re: Parse error at '<mx:dataProvider>'
          *Prashant Shelke* Level 4

          I think you have not specified data for Object


          <mx:Object label="1" data="1" />


          referr this:


          <?xml version=”1.0″ encoding=”utf-8″?>
          <mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml”   xmlns:fx=”com.theriabook.controls.*”>
              <mx:ArrayCollection id=”comboData”>
                  <mx:Array>
                      <mx:Object label=”New York”   data=”NY”/>
                      <mx:Object   label=”Connecticut” data=”CT”/>
                      <mx:Object label=”Illinois”   data=”IL”/>
                  </mx:Array>
              </mx:ArrayCollection>
              <mx:Label text=”Current bound value is ‘{cbx_1.value}’ ” />
              <fx:ComboBox id=”cbx_1″ value=”IL” width=”150″ dataProvider=”{comboData}”/>
          <mx:Application>


          Thanks.

          • 2. Re: Parse error at '<mx:dataProvider>'
            BennyBeta Level 4

            What you have looks like it should work, but I don't have a Flex 2 compiler handy, so maybe try this:

             

                 <mx:Array id="theData">
                     <mx:Object label="1"/>
                     <mx:Object label="2"/>
                 </mx:Array>


                <mx:ComboBox itemRenderer="mx.controls.Label" width="236" dataProvider="{theData}">

                </mx:ComboBox>

             

            Does that help at all?

             

            Ben Edwards