Flex Tree Control-example1

This Flex Treecontrol example demonstrate the simple tree navigation fo the static contents,Here we are providing the XML List as dataprovider for the <mx:Tree /> component
see the full example below and follow the comments for the demo of the flex tree control demonstration in flashplayer.

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


            public var selectedNode:XML;

            // Event handler for the Tree control change event.
            public function treeChanged(event:Event):void {
                selectedNode=Tree(event.target).selectedItem as XML;

    <mx:XMLList id="treeData">
        <node label="Mail Box">
            <node label="Inbox">
                <node label="Marketing"/>
                <node label="Product Management"/>
                <node label="Personal"/>
            <node label="Outbox">
                <node label="Professional"/>
                <node label="Personal"/>
            <node label="Spam"/>
            <node label="Sent"/>

    <mx:Panel title="Tree Control Example" height="75%" width="75%"
        paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">

        <mx:Label width="100%" color="blue"
            text="Select a node in the Tree control."/>

        <mx:HDividedBox width="100%" height="100%">
            <mx:Tree id="myTree" width="50%" height="100%" labelField="@label"
                showRoot="false" dataProvider="{treeData}" change="treeChanged(event)"/>
            <mx:TextArea height="100%" width="50%"
                text="Selected Item: {selectedNode.@label}"/>

No comments:

Post a Comment