1 Reply Latest reply on Apr 8, 2008 10:12 AM by ntsiii

    Switch from Flex Builder 2 to Flex Builder 3

    garag
      Hi All,
      I've developed an application in Flex Builder 2 and I'm trying to switch it in Flex Builder 3.
      My application receives data from a webservice, it returns a xml like this

      <result>
      <item _id="1">
      <field1>value1</field1>
      <field2>value2</field2>
      </item>
      <item _id="2">
      <field1>value1</field1>
      <field2>value2</field2>
      </item>
      </result>

      In Flex Bulder 2, I'm using an instruction like this:
      var results : ArrayCollection = new ArrayCollection ( [event.result.CallResult.result.item] [0]);
      in order to retrieve the data from the web sarvice call and link this data to the property dataprovider of a datagrid of my application: it works perfectly. In the ArrayCollection named results, I see the nodes returned by the webservice call and the attributes of the xml as well.
      Switching on Flex Builder 3, the same code used in Flex Builder 2 doesn't work. I mean that in Flex Builder 3 I'm not able to see, in the ArrayCollection, the attributes of the xml returned by webservice call but only the nodes of the xml.
      Is it a change (worst change) implemented in Flex Builder 3?
      If I try to format in "e4x" the data returned by the webservice, I obtain an XMLList collection. How is possible to link this data to my application datagrid?

      Thank you.

      Regards
        • 1. Re: Switch from Flex Builder 2 to Flex Builder 3
          ntsiii Level 3
          Note that if you are not already using reslutFormat="e4x", you do not have xml at all. You have a tree of dynamic objects.

          There were some changes to this conversion process, partly as I recall to better integrate with dot.net web services that returned DataTables. If youwant to stick with the nested object structure, perhaps you can find the description of the conversion in the docs. I don't use this, I prefer e4x xml.

          [Bindable]private var _xlcItems:XMLListCollection; //bind the dg to this instance-level var

          In the result handler:
          var xmlResults : XML = XML(event.result);
          trace(xmlResults)
          var xlItems:XMLList = xmlResults.item;
          trace(xlItems.length())
          xlcItems = new XMLListCollection(xlItems)

          Tracy