3 Replies Latest reply on Nov 9, 2006 12:52 PM by ntsiii

    Problems with HTTPService + ArrayCollection

    ju2999 Level 1

      I use a HTTPService to get the contents of an xml document:

      <mx:HTTPService id="dataServ" concurrency="single" makeObjectsBindable="true" url="data.xml" useProxy="false" resultFormat="object" contentType="application/xml" />
      <mx:ArrayCollection id="resData" source="{mx.utils.ArrayUtil.toArray(dataServ.lastResult.element)}" />

      If the xml contains only one element of one type, the "arraycollection" only offers directly an object, but not an array with one object inside.

      For example:

      <sub1 />
      <sub2 />

      will result with an object at resData.element.
      If I have two elements, there will be an array with two objects inside.
      I need some code that provides me with a consistent behaviour.