2 Replies Latest reply on Aug 18, 2006 2:07 PM by deepa subramaniam (adobe)

    Regression with tree.iconFunction: default icons have disapperead

    kohinoor75
      I have a tree control, with icon function redifined.
      However, for some items, I would like to use default tree icons (folder, sheet,...)
      In Flex 1.5, if returned null from the iconFunction, the default icon was displayed.
      In Flex 2.0, this does not work anymore. The doc says that the icons are in Assets.swf, but how to reference and embed them in my application ?
        • 1. Re: Regression with tree.iconFunction: default icons have disapperead
          bnambooz
          Here's a code snippet of one way to set Tree's icons:

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" width="600" height="600">
          <mx:Script>
          <![CDATA[
          [Bindable]
          [Embed(source="smallU.jpg")]
          public var redU:Class;

          [Bindable]
          public var treeArray:Object =
          [
          { label:"Containers", children:
          [
          { label:"DividedBoxClasses", children:
          [
          { label:"BoxDivider", data:"BoxDivider.as" }
          ]
          },
          { label:"GridClasses", children:
          [

          { label:"GridRow", data:"GridRow.as" },
          { label:"GridItem", data:"GridItem.as" }

          ]
          }

          ]
          },

          { label:"Printing", children:
          [
          { label:"PrintJob", data:"PrintJob.as"},
          { label:"PrintJob1", data:"PrintJob1.as" },
          { label:"PrintDataGrid", data:"PrintDataGrid.as" }
          ]
          }



          ];
          ]]>
          </mx:Script>
          <mx:Tree dataProvider="{treeArray}" disclosureClosedIcon="{redU}" />

          </mx:Application>

          There's a a style property mapping to each Tree icon (ex: folderOpenIcon, defaultLeafIcon).

          Hope that helps,
          Belinda
          • 2. Re: Regression with tree.iconFunction: default icons have disapperead
            deepa subramaniam (adobe) Level 2
            The default icons for Tree are indeed embedded in Assets.swf. You can find out the names of the symbols in defaults.css by checking the Tree type selector entries.

            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");