I am having a problem in displaying  the data in tree control

<mx:HTTPService url="http://localhost:9090/Portalserver/newxml.jsp"; 
id="newxmlHttp" useProxy="false" method="POST" showBusyCursor="true"/>

//newxml.jsp is returning me this xml.

<DirectoryTree>

<Directory Did="6" Dname="santhosh" >
        <File Fid="84"     name="abcd" />
        <File Fid="85"     name="efgh" />
        <File Fid="86"     name="ijkl" />

</Directory>


<Directory Did="7" name="java" >
        <File Fid="87"     name="reflection" />
        <File Fid="88"     name="container" />
        <File Fid="89"     name="component" />

</Directory>

<Directory Did="8" name="flex" >
        <File Fid="90"     name="controls" />
        <File Fid="91"     name="apollo" />
        <File Fid="92"     name="asp" />

</Directory>

</DirectoryTree>


and in the mxml file...
i have used.

<mx:Tree x="0" y="0" id="tree"   height="294" width="230"  
creationComplete="newxmlHttp.send()"   labelFunction="treeLabel" 
visible="true" labelField="@name">

<mx:XMLListCollection id="dirxml" 
source="{newxmlHttp.lastResult.DirectoryTree.Directory}">
                
</mx:XMLListCollection>

</mx:Tree>


and in the action script i have written ..

private function treeLabel(item:Object):String
            {
                                if(item == null)
                                        Alert.show("item null");
                var node:XML = XML(item);
                if( node.localName() == "Directory" )

                    return [EMAIL PROTECTED];
                else
                    return [EMAIL PROTECTED];
            }


Reply via email to