2 Replies Latest reply on Dec 26, 2012 4:50 AM by denbru1991

    Problem with binding ArrayCollection

    denbru1991

      Hello everyone,

       

      I've created an AS function WeatherSearch that fills an arraycollection and then returns it.

       

       

      [Bindable] public var acWeather:ArrayCollection = new ArrayCollection

       

      public function WeatherSearch(tag:String, days:Number){

       

      ........

      public function fillAC(event:ResultEvent):void

              {

                  acWeather.addItem(event.result.data.weather)

       

              }

       

      public function getACweather():ArrayCollection

       

              {

                  return acWeather                   

       

              }

      }

      .......................................................................................... ..............................................

       

       

      But in my main mxml, I get the following error:

       

      TypeError: Error #1034: Type Coercion failed: cannot convert mx.collections::ArrayCollection@d09d431 to Array.

       

       

       

      [Bindable]public var theSearch:WeatherSearch;

      .......................

      theSearch = new WeatherSearch(txtSearch.text, index);

       

       

      <s:ArrayCollection id="weather" source ="{theSearch.acWeather}">

       

      </s:ArrayCollection>

       

       

      What am I doing wrong? Thanks in advance!