2 Replies Latest reply on Jan 22, 2011 7:03 PM by davidd3141525

    Trying to set an ArrayCollection to event.result but receiving an error

    davidd3141525

      After retrieving data from a PHP call I am trying to convert event.result to an ArrayCollection like this:

       

      myArrayCollection = event.result;

       

      I am receiving the following compiler error:

       

      1118: Implicit coercion of a value with static type Object to a possibly unrelated type mx.collections.ArrayCollection

       

      I can accomplish what I'm doing but I need a second variable, as follow:

       

      public var myResultsArray : Array;

       

      [Bindable]

      public var myArrayCollection : ArrayCollection;

       

      myResultsArray = mx.utils.ArrayUtil.toArray(event.result);

      myArrayCollection = myResultsArray[0];

       

      When I debug and look at the variables myArrayCollection and event.result look the same.

       

      This seems to work, is there anything wrong about it:

       

      myArrayCollection = mx.utils.ArrayUtil.toArray(event.result)[0];

       

      Thanks,

       

      David