Hi Jonas,

The Tree control has a few new attributes and classes to take advantage
of AS3, e4x and to be generally consistent with other components like
List.  For the same reasons, we've also removed the ITreeDataProvider
interface and its related classes.

Things to keep in mind when using the new Tree are:

XML data requires an e4x labelField value  e.g. labelField="@label"

Tree toggles the root node visiblity via Tree.rootVisible="false"  The
default is true which is the opposite of the earlier Tree.

See the DefaultTreeDataDescriptor class for information on how the Tree
will parse data by default.  The default may be too aggressive or simply
not match the data you'd like to display.

Here's an example that might help:

tree.xml:

<?xml version="1.0" encoding="utf-8"?>
<node>
     <node label="My 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>
</node>

TreeDemoHttpService.mxml:

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml";
                 creationComplete="srv.send()">

    <mx:Script>
      <![CDATA[
         [Bindable]
         public var selectedNode:Object;

         [Bindable]
         public var XLC:XML;

         public function initList(event:Event):void {
             XLC = event.target.result;
         }

         public function treeChanged(event:Event):void {
             selectedNode=Tree(event.target).selectedNode;
         }
      ]]>
    </mx:Script>

    <mx:HTTPService id="srv" url="tree.xml" resultFormat="e4x"
result="initList(event)"/>

    <mx:HDividedBox width="100%" height="100%">
       <mx:Tree id="myTree" width="50%" height="100%"
                  labelField="@label" rootVisible="false"
                  dataProvider="{XLC}"
                  change="treeChanged(event)"/>
       <mx:TextArea height="100%" width="50%" text="Selected Item:
[EMAIL PROTECTED]"/>
    </mx:HDividedBox>
</mx:Application>



-Michael



--- In flexcoders@yahoogroups.com, "Jonas Windey" <[EMAIL PROTECTED]> wrote:
>
> Hi, I just installed the new beta release and I'm having some
problems.
>
>
>
> I have the feeling that the Tree component isn't working the way it
worked
> before? (in the alpha version)
>
> When I give it an xml feed as dataprovider, it doesn't create
childnodes
> automatically. Any ideas?
>
>
>
> Also the explorer folder in the samples folder doesn't seem to work
anymore
> (since there are no .swf's anymore, I suppose they are all made to be
run in
> an enterprise services 2 environment?
>
> Are we force to use this? I always liked the idea of an swf compiled
without
> the need for a server who compiles the mxml files at runtime.
>
>
>
> Thanks for any response,
>
>
>
> Jonas Windey
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to