1 Reply Latest reply on Sep 19, 2006 2:35 PM by bnambooz


    dzlmbq Level 1
      I am moving a Flex 1.5 app to 2.0 and am having issues with the tree.iconfunction. The iconfunction does a search against tree labels. If the label is not found I do not see any folders or default flex icons in the tree. In 1.5 I did see the default icons when the iconfunction returned nothing. Anyone have a way to tell Flex 2.0 to use the default tree icons when an icon is not found in a custom iconfunction? Anyone?

      private var leafSymbol:Class;
      private var appSymbol:Class;
      private var homeSymbol:Class;
      private var mediaSymbol:Class;
      private var docsSymbol:Class;
      private var newSymbol:Class;
      private var authorSymbol:Class;

      private function treeIconFunc(item:Object):Class
      var type:String = item.label;
      var docType:Class;
      case "Architecture Diagrams":
      docType = appSymbol;
      case "Home":
      docType = homeSymbol;
      case "Multimedia":
      docType = mediaSymbol;
      case "Whitepapers":
      docType = docsSymbol;
      case "New":
      docType = newSymbol;
      //docType = folderClosedIcon;
      return docType;

      <mx:VBox width="100%" height="100%">
      <mx:Tree id="myTree" width="100%" height="100%"
      showRoot="false" dataProvider="{_xmlData}"
      iconFunction="treeIconFunc" labelField="@label"
      itemRenderer="MyTreeItemRenderer" visible="false"/>
        • 1. Re: Tree.iconfunction
          The default skins are stored inside Assets.swf, in your frameworks directory, corresponding to each Tree style property as you see in default.css:
          defaultLeafIcon: Embed(source="Assets.swf",symbol="TreeNodeIcon");
          disclosureClosedIcon: Embed(source="Assets.swf",symbol="TreeDisclosureClosed");
          disclosureOpenIcon: Embed(source="Assets.swf",symbol="TreeDisclosureOpen");
          folderClosedIcon: Embed(source="Assets.swf",symbol="TreeFolderClosed");
          folderOpenIcon: Embed(source="Assets.swf",symbol="TreeFolderOpen");

          So you need to have a default case at the end of your switch statement, and depending on the folder type and state (branch, leaf, open, closed), return of one the skinds from Assets.swf.