8 Replies Latest reply on Sep 17, 2007 10:13 AM by qwerty197x

    How to convert string to XMLListCollection?

    swickes
      This much is working fine:

      1. ColdFusion reads data from db; then puts nodes in order and creates a string text representing xml nodes
      2. Flex retrives this string using remoteObject
      3. Flex creates the Tree using the string as a dataprovider

      This I can't get to work:
      1. I would like to convert my imported string into an XMLListCollection and use the XLC as the dataprovider for the tree.

      I have tried a dozen approaches, and nothing works. I think I am limited by my understanding of how to convert a string to xml to an xmllist to an xmlistcollection.

      Any ideas? Am I making a mistake by importing the info from ColdFusion using a simple string?

      Thanks,
      Steve

      Here's the working Flex:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" >

      <mx:Script>
      <![CDATA[
      import mx.rpc.events.ResultEvent;
      import mx.controls.Alert;
      [Bindable]
      public var treeList:Object;

      ]]>
      </mx:Script>

      <mx:RemoteObject
      id="treeService"
      destination="ColdFusion"
      source="MenuTree"
      result="treeList=event.result"
      fault="Alert.show(event.fault.faultString, 'Error');"/>

      <mx:Button label="Load Tree" x="10" y="10" click="treeService.getTree()" />

      <mx:Tree id="myTree" width="500" height="600" labelField="@label"
      showRoot="true" dataProvider="{treeService.getTree.lastResult}" x="10" y="60"/>

      </mx:Application>