Thanks Robert!
 
Precia taught me a new trick that solved my problem:
 
This does not work:
<mx:XMLListCollection id="xc" source="{filterData.lastResult.filter.item
}"/>
 
But, this does:
<mx:XMLListCollection id="xc" source="{filterData.lastResult...item }"/>
 
This would seem to access the same data. But apparently, AS3 does not like
for you to reference the root node. So, the second syntax works, but the
first one doesn't!
 
I thought you all might like to know in case you run into this.
 
    Clarke
 

  _____  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Capilli
Sent: Thursday, April 26, 2007 1:39 PM
To: [email protected]
Subject: RE: [AFFUG Discuss] Using XML as a dataProvider



This is what I do.

 

            <!-- Gets the site tree to be displayed -->

            <mx:RemoteObject id="e4xService"
endpoint="http://apps.eyewonderlabs.com/flex2gateway/";
destination="ColdFusion"
source="robert.SiteSpecSystem.CFC.RecursiveSearchForTree"
result="SaveXMLData(event)"/>      

    <mx:XMLListCollection id="myXMLList" source="{myXML.node}"/>

 

 

 

Then in my Data Tree I do this..

 

 

<mx:Tree id="myTree"
folderClosedIcon="@Embed(source='images/icon_parent.png')" 

 
folderOpenIcon="@Embed(source='images/icon_parent.png')"

 
defaultLeafIcon="@Embed(source='images/icon_child.png')"

 
x="10" y="26" width="100%" dataProvider="{myXMLList}" labelField="@label"  

 
change="selectNode(event,'Tree')" height="443"/>

 

 

Notice the labelField.  @label

 

My XML has a attribute called Label.

 

<Employee Label="john smith">

 

This displays the Label within my tree

 

If you need I can send you the file that I do this in and you can see how
it's done. I build my XML file dynamically via the DB. Then I use the XML
file as shown above.

 

  _____  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Clarke Bishop
Sent: Thursday, April 26, 2007 1:20 PM
To: [email protected]
Subject: [AFFUG Discuss] Using XML as a dataProvider

 

I am trying to use XML (e4x format) as a dataProvider.

1. I load the XML via an HTTPService call that is triggered by the
CreationComplete event that calls my init() method.


<mx:HTTPService id="filterData" url="ModelData/FilterData.xml" 
result="xmlResult()" resultFormat="e4x" />

2. The XML data comes back. I can see it with the debugger in lastResult.

3. I'm trying to assign the filterData XML to an XMLListCollection like
this:

<mx:XMLListCollection id="xc" source="{filterData.lastResult.filter.item
}"/>

I know the dataGrid is supposed to automatically convert an XMLList to an
XMLListCollection, but since it's not working, I thought I could understand
it better by doing it manually.

The problem is that even though the XML data is there, the XMLListCollection
stays blank. What am I missing?

By the way, here's an example of my external XML file:

<?xml version="1.0" encoding="UTF-8"?>
<filter>
   <item section="Mission">
      <question>Do you like this color?</question>
      <response>Y</response>
   </item>
</filter>

Thanks for any ideas!

   Clarke 


------------------------------------------------------------- 
To unsubscribe from this list, simply email the list with unsubscribe in the
subject line 

For more info, see http://www.affug.com 
Archive @ http://www.mail-archive.com/discussion%40affug.com/ 
List hosted by FusionLink <http://www.fusionlink.com>  
------------------------------------------------------------- 
------------------------------------------------------------- 
To unsubscribe from this list, simply email the list with unsubscribe in the
subject line 

For more info, see http://www.affug.com 
Archive @ http://www.mail-archive.com/discussion%40affug.com/ 
List hosted by FusionLink <http://www.fusionlink.com>  
------------------------------------------------------------- 



-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------

Reply via email to