2 Replies Latest reply on Jan 8, 2007 1:27 AM by JamieMason

    event:.result type different if # of child nodes == 1

    JamieMason
      Can anyone help with this? We're calling an XML file using HTTPService returning an ArrayCollection by the default setting, which is passing the ResultEvent to a function;

      <mx:HTTPService
      id="someId"
      url=" http://www.somedomain.com/someXML.xml"
      useProxy="false"
      result="someFunction(event)"
      />

      Lets say the XML is;

      <root>
      <somenode>text</somenode>
      <somenode>text</somenode>
      <somenode>text</somenode>
      </root>

      I'd get the following traces;

      trace(event.result.root.somenode) // [object Object],[object Object],[object Object]
      trace(typeof(event.result.root.somenode)) // object
      trace(event.result.root.somenode.length) // 3

      But if the XML at one time was;

      <root>
      <somenode>text</somenode>
      </root>

      I'd get the following traces;

      trace(event.result.root.somenode) // [object Object]
      trace(typeof(event.result.root.somenode)) // object
      trace(event.result.root.somenode.length) // null

      Does anyone know why this is? Is Flex returning an array if > 1 and an object if == 1?

      Thanks a lot,


      Jamie