7 Replies Latest reply on Jun 1, 2007 11:12 AM by benrsch

    Multiple initializers for property 'dataProvider'

    JoeADSK
      just curious what this error is... This code is nearly an exact copy from one of my previous examples and now it wont work.
      and ideas???

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
      <![CDATA[
      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;
      import mx.controls.Alert;

      [Bindable]
      public var qResult:ArrayCollection;


      public function handleQueryResult(event:ResultEvent):void{
      qResult=event.result as ArrayCollection;

      }

      public function clearAll():void{
      qResult=new ArrayCollection();
      }
      ]]>
      </mx:Script>

      <mx:RemoteObject
      id="myService"
      destination="ColdFusion"
      source="artAccess"
      showBusyCursor="true"
      >
      <mx:method name="sayHelloQuery" result="handleQueryResult(event)" fault="Alert.show(event.fault.message)"/>
      </mx:RemoteObject>

      <mx:Button label="get Query Remote Object" click="myService.sayHelloQuery()"/>

      <mx:PieChart id="Chart" dataProvider="{qResult}" height="100%" width="100%">
      <mx:PieSeries id="Series1" field="PRICE" >
      </mx:PieSeries>
      </mx:PieChart>
      </mx:Application>
        • 1. Re: Multiple initializers for property 'dataProvider'
          JoeADSK Level 1
          Nevermind.... i deleted what i had and dragged a pie from the component... same code... and it compiled... i couldnt see the difference... but here it is...

          <mx:PieChart x="125" y="90" id="piechart1" dataProvider="{qResult}" height="100%" width="100%" >
          <mx:series>
          <mx:PieSeries displayName="Series 1" field="PRICE" labelPosition="callout" />
          </mx:series>
          </mx:PieChart>
          • 2. Re: Multiple initializers for property 'dataProvider'
            ntsiii Level 3
            Probably a collision with the id="Chart" and a Flex framework class.
            Tracy
            • 3. Re: Multiple initializers for property 'dataProvider'
              JoeADSK Level 1
              I believe this is a bug in the compiler. When you declare a dataProvider 2 times (once in a chart and once in say... a Category axis tag ... it says that error Multiple initializers blah blah... and will remain there even if the correction is made in your code. I tested this theory by declaring it 2 times... correcting it... and producing the error...
              THE ONLY way i have found to fix this is to delete whatever thing you were providing the data for.. and drag an instance of it from design mode.
              • 4. Re: Multiple initializers for property 'dataProvider'
                mxc4
                I am new to flex and using it on Linux I also get the error message

                Multiple initializers for property 'dataProvider'. (note: 'dataProvider' is the default property of 'mx.controls.DataGrid').

                When compiling a component that uses a DataGrid. Where can we find more info about this bug? Does it affect the chart component only or also the data grid? If I dont stipulate a data provder the grid is populated with someobject that has fields like

                field, dataTipField, dataTipFunction...headerWordWrap,imemode?

                I have no idea where it is picking this data source up from.
                • 5. Re: Multiple initializers for property 'dataProvider'
                  mxc4 Level 1
                  Hi all,

                  I have found that if I delete all DataGridColumn tags then the application compiles but no data is shown. It seem that either the datagrid is horribly broken or I am doing something basic incorrectly.

                  I assume you have to have DataGridColumn tags in the DataGrid. Why does flex thing there are two dataProviders? I do no specify one for the columns I only declare the dataField varaibel i.e

                  dataField="myns::varaible.myns::name"

                  Any help appreciated.
                  • 6. Re: Multiple initializers for property 'dataProvider'
                    mxc4 Level 1
                    Ok I was missing
                    <mx:columns>
                    • 7. Re: Multiple initializers for property 'dataProvider'
                      benrsch
                      This is exactly the answer I was looking for. I thought I'd add the following tag line from the error message,

                      Implementation of interface XXX cannot be added to class YYY, due to collision with existing method or property QQQ.

                      To hopefully make things easier when people are searching for an answer to this problem. This is definitely a builder issue, because the code compiles without issue using the SDK.