Hi Tracy. Unfortunately my server is down, and my ISP has no idea 
why. Frustrating. 

I appreciate your help. Here is what I have, in gist:

<mx:Tree id="myTree" width="50%" height="50%" labelField="@label"
                showRoot="false" dataProvider="{treeData}" 
change="treeChanged(event)"/>

...and in the same file I have, of course:

    <mx:XMLList  id="treeData">
etc...    
    </mx:XMLList>

This works perfectly how I want, minus it's being compiled in the swf.

...the "gURL" attribute I am hoping to be able to fire off to another 
HTTPService item, a repeater HorizontalBox thing also from the 
examples, and that actually works (the file "catherine.xml" for 
example, if I go into it, I can change anything without recompiling 
the swf's, and it loads, the same way I need this tree too.

So based on your example, I tried the following:

Here is the new external file, called galleriesData.xml, it's exactly 
what currently sits in the XMLList above excluding the first line:

<?xml version="1.0" encoding="iso-8859-1"?>
    <root>
      <item isBranch="true" label="animals" gURL="animals.xml">
        <item isBranch="true" label="fish" gURL="fish.xml">
          <item isBranch="false" label="halibut" gURL="halibut.xml"/>
          <item isBranch="false" label="east coast sockeye" 
gURL="east_coast_sockeye.xml"/>
          <item isBranch="false" label="west coast sockeye" 
gURL="west_coast_sockeye"/>
        </item>
        <item isBranch="true" label="people" gURL="people.xml">
          <item isBranch="false" label="Catherine" 
gURL="Catherine.xml"/>
        </item>
      </item>
      <item isBranch="false" label="vegetables" 
gURL="vegetables.xml"></item>
      <item isBranch="true" label="Worst Case Scenario - KINGDOM" 
gURL="etc">
        <item isBranch="true" label="Worst Case Scenario - ANIMALs" 
gURL="etc">
          <item isBranch="true" label="Worst Case Scenario - MAMMALS" 
gURL="etc">
            <item isBranch="true" label="Worst Case Scenario - 
PRIMATES" gURL="etc">
              <item isBranch="false" label="Worst Case Scenario - 
MAN" gURL="etc"/>
            </item>
          </item>
        </item>
      </item>
    </root>

So the HTTPService would be, if I read you right:

<mx:HTTPService id="loadGal" url="model/galleriesData.xml" 
resultFormat="e4x"  result="myTreeData();" useProxy="false" />

...and the Tree would now read...I have no idea. 

What you wrote about "a resultHandler function to assign the result 
to an instance level variable. Bind the tree to the variable" is 
where I get lost. So I don't use "loadGal" as the data provider, but 
a variable? As you can see, I have no idea what 
the "result='myTreeData();'" function I called in the HTTPService 
result would look like, how to write it. 

I can't wait for the Flex books to come out, I find all the 
documentation overwhelming...going from Flash/AS1 to this is very 
very fun, but also making me lose weight LOL.


Shawn


--- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> Yes, this is pretty straightforward.  Where are you stuck?
> 
>  
> 
> Get your tree displaying with XML that is "hard-coded" first 
(obviously
> use the exact same format as your real data will use).
> 
>  
> 
> Then cut that data out into an xml file and save it on a server
> somewhere.
> 
>  
> 
> Then use HTTPService, resultFormat="e4x" to get the data, and a
> resultHandler function to assign the result to an instance level
> variable. Bind the tree to the variable.
> 
>  
> 
> Beware of caching issues.  This seems to b a big problem when 
loading
> data from a file.  If you see the problem , search the archives for 
it.
> 
>  
> 
> I'll try to post a simple example. 
> 
>  
> 
> Tracy
> 
>  
> 
> ________________________________
> 
> From: [email protected] 
[mailto:[EMAIL PROTECTED] On
> Behalf Of shawn.gibson
> Sent: Sunday, March 11, 2007 5:38 PM
> To: [email protected]
> Subject: [flexcoders] HTTPService-driven Tree
> 
>  
> 
> Hi Guys, I finally figured I'd ask here, I have practically given up
> LOL. Is there any way to populate the Flex 2 Tree control with
> HTTPService, reading an XML file, live, so any changes you make to 
the
> XML file can take place in the Flash Player without having to
> recompile the component, module, or app?
> 
> For perfect example, how would I take even just the Adobe example, 
and
> turn it into an XML file that the Tree can load as a data source?
> 
> <mx:XMLList id="treeData">
> <node label="Mail Box">
> <node label="Inbox">
> <node label="Marketing"/>
> <node label="Product Management"/>
> <node label="Personal"/>
> </node>
> <node label="Outbox">
> <node label="Professional"/>
> <node label="Personal"/>
> </node>
> <node label="Spam"/>
> <node label="Sent"/>
> </node> 
> </mx:XMLList>
> 
> I know there's a lot of jumping around with XMLListCollection, 
XMLList
> and other various things, I have plugged away till the cows come 
home,
> but nothing works...and I've not come across a single example of a
> tree populated by HTTPService using XML...only a very complex 
example
> with a db, from Bruce Phillips
> (http://www.brucephillips.name/blog/index.cfm/2007/1/1/How-To-Use-
An-Arr
> ayCollection-As-The-Data-Provider--For-The-Flex-2-Tree-Control
> <http://www.brucephillips.name/blog/index.cfm/2007/1/1/How-To-Use-
An-Arr
> ayCollection-As-The-Data-Provider--For-The-Flex-2-Tree-Control> )
> 
> I am trying to generate what would be exactly the same kind of 
output
> as Adobe's example above...multiple nodes, with any number within, 
so
> I can use it as navigation for my photo gallery site.
> 
> Any suggestions?
> 
> Thanks kindly for any help:)
> 
> shawn
>


Reply via email to