Ok, that sounds fine with me. Now I am not sure why the XML is not loading
when I start up the application. I have the following code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
               xmlns:comp="components.*"
               creationComplete="initTree()">

   <mx:Script>
       <![CDATA[
           import mx.collections.XMLListCollection;
           import mx.events.TreeEvent;
           import mx.rpc.events.ResultEvent;
           import mx.collections.ArrayCollection;
           import mx.controls.Alert;

           public var orgCodes:XML;

           [Bindable] public var selectedNode:Object;

           private function initTree():void{

               orgCodeService.getOLCs("2");
               theTree.showRoot = false;
               theTree.labelField = "@label";
               theTree.dataProvider = orgCodes;
           }

           private function getOrgCodeHandler(event:ResultEvent):void{
               orgCodes = event.result as XML;

           }

       ]]>
   </mx:Script>

   <mx:RemoteObject id="orgCodeService" destination="ColdFusion" source="
OrgLevelCodes.raggedOlcGateway" showBusyCursor="true">
       <mx:method name="getOLCs" result="getOrgCodeHandler(event)" fault="
Alert.show(event.fault.message)"></mx:method>
   </mx:RemoteObject>

   <mx:Panel layout="absolute" right="10" left="10" top="41" bottom="10"
title="Org Codes" id="panel1">
       <mx:HDividedBox id="hboxMain" width="100%" height="100%">
       <mx:Tree id="theTree"
                width="100%"
                height="100%">
       </mx:Tree>
       </mx:HDividedBox>
   </mx:Panel>
</mx:Application>


On 12/20/06, Battershall, Jeff <[EMAIL PROTECTED]> wrote:

   That's what I do - using CF's built-in XML functions - works fine.

Jeff

 -----Original Message-----
*From:* [email protected] [mailto:[EMAIL PROTECTED] *On
Behalf Of *Kyle Hayes
*Sent:* Wednesday, December 20, 2006 9:48 AM
*To:* [email protected]
*Subject:* Re: [flexcoders] Populating Multiple Levels of Branches

That is what I was looking for and I used 
selectedNode.setChildren(theArrayCollectionofMyQuery)
and it blanked out the entire tree instead :-\
I was talking to a Flex instructor yesterday and he was saying that the
Tree's favorite type of data to receive is XML and it would be a lost easier
and more structural to have the CFC return XML instead of a query. What is
everybody's thoughts on that?

-Kyle

 On Dec 20, 2006, at 1:19 AM, Lachlan Cotter wrote:


Hi Kyle,

Listen on your tree control for the itemOpen event. Retrieve the tree node
from the event, pull from it what information you need for your next query.
When the query returns, append the results as children of that node.
Bindings should update the tree control.

Is that what you were looking for?

Cheers,
Lach


 On 20/12/2006, at 9:04 AM, Kyle Hayes wrote:

I am quite new to Flex and was planning on learning it very soon
which ended up being sooner than I thought because of a project that
could really use it. So here I am.

The application I am designing needs to display a hierarchal list of
codes. All the codes are related to each other in that one is abover
another.
…


Inside my database there is a table that raggedly displays this data
in 11 columns (the 11 levels)

1 2 3 4 5 6 7 8 9 10 11
AA AAA
AA AAB AABA
AA AAB AABB
AA AAB AABC AABCA
AA AAB AABC AABCB

etc

So I want to query this data in which case I have already built a
function in ColdFusion to return the DISTINCT items for a level that
I specify

Which in my example would produce

AA
AB

for level 1

I am able to return that much to a tree and have it display the
folders by adding a column pragmatically to the Query called
"children". There are 10s of thousands of records in this table so I
do not want to grab all this data at once. I want the next level for
a specified entity to be pulled from the CFC when I click it. How do
I append this information to a folder item?

Thanks a bunch!
-Kyle








--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Kyle Hayes
ColdFusion | RIA
Boeing - Web Application Development

Reply via email to