1 Reply Latest reply on Dec 21, 2011 1:13 PM by Flex harUI

    Cannot convert mx.collections::ArrayCollection to mx.collections.ArrayList

    m.verdier

      Hello,

       

      i created the code below :

       

      trace(" --- EVENT RESULT SIZE = " + event.result.length + "   TYPE = " + event.result.valueOf() + " --- ");

      var resultArray:Array = event.result as Array;

      trace(" - - - getGeneralStat_resultHandler 1 ARRAY                  = " + resultArray.length);

       

      var resultArrayCollection:ArrayCollection = new ArrayCollection(resultArray);

      trace(" - - - getGeneralStat_resultHandler 2 ARRAY COLLECTION       = "+resultArrayCollection.length);

       

      model.statsResult = new ArrayCollection(resultArray);

      trace(" - - - getGeneralStat_resultHandler 3 ARRAY COLLECTION MODEL = "+model.statsResult.length);

       

      My model is the AppModel and contains :

       

      public var statsResult:ArrayCollection;

       

      The trace 1 and 2 display correctly.

       

      I have the message error : Cannot convert mx.collections::ArrayCollection to mx.collections.ArrayList for the line : model.statsResult = new ArrayCollection(resultArray);

      The cast works fine with the line

      var resultArrayCollection:ArrayCollection = new ArrayCollection(resultArray);

      but not with the line

      model.statsResult = new ArrayCollection(resultArray);

       

      Need some help for that.

       

      Thank you.