hai,
     I' like to change the default icon for the tree based on some condition. the code which i'm using right now doen't work.. pls tell me where i go wrong
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script>
<![CDATA[
[Embed(source="l_green.gif")]
var myIcon : String;
function iconFunc(item)
{
  if (item.label == "Food") return myIcon;
  else return
  myTree.getStyle("defaultLeafIcon");
}
]]>
</mx:Script>
<mx:Panel height="100%" width="40%" title="CATALOG">
           <mx:Tree id="myTree" height="100%" width="100%" iconFunction="iconFunc"  defaultLeafIcon="@Embed('assets/online1.png')" disclosureClosedIcon="@Embed('plus.png')" disclosureOpenIcon="@Embed('minus.png')" folderOpenIcon="@Embed('l_red.gif')" folderClosedIcon="@Embed('l_red.gif')" >
   <mx:dataProvider>
      <mx:XML>
    .
    .
    .
        </mx:XML>
   </mx:dataProvider>
</mx:Tree>
    </mx:Panel>
</mx:Application>


Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now

Yahoo! Groups Links

Reply via email to