1 Reply Latest reply on Jul 20, 2006 5:12 PM by Josh Johnson

    Tree Icon Trouble

    truly_great
      I have searched through the "lovely" :p Flex help files and have come up with the coding to change the open/closed icons for the tree, BUT - when I put them in as part of my tree style, it doesn't cause an error, but suddenly my whole tree, including the background does not show.

      The Flash 8.5 player I have does not seem to come with a debugger in it, so I can't find out what is wrong.

      My code is either:

      <mx:Style>
      Tree {
      roll-over-color: #cccc99;
      selection-color: #fffccc;
      folderClosedIcon: "images/folder-closed_16.gif";
      folderOpenIcon: "images/folder-open_16.gif";
      defaultLeafIcon: "images/documents_16.gif";
      }
      </mx:Style>

      OR:

      <mx:Style>
      Tree {
      roll-over-color: #cccc99;
      selection-color: #fffccc;
      folderClosedIcon: "@Embed('images/folder-closed_16.gif')";
      folderOpenIcon: "@Embed('images/folder-open_16.gif')";
      defaultLeafIcon: "@Embed('images/documents_16.gif')";
      }
      </mx:Style>

      OR:

      <mx:Style>
      Tree {
      roll-over-color: #cccc99;
      selection-color: #fffccc;
      folderClosedIcon: "@Embed(source='images/folder-closed_16.gif')";
      folderOpenIcon: "@Embed(source='images/folder-open_16.gif')";
      defaultLeafIcon: "@Embed(source='images/documents_16.gif')";
      }
      </mx:Style>

      If I take out the Icon styles, it works fine, just with the boring Icons.

      Any ideas?

      Thia
        • 1. Re: Tree Icon Trouble
          Josh Johnson Level 1
          I was looking to do the same thing, but in Flex 2, I get an error (see below) and the whole rest of the app doesn't display.

          TypeError: Error #1034: Type Coercion failed: cannot convert "images/folderClosed16.png" to Class.
          at mx.controls::Tree/itemToIcon()
          at mx.controls::Tree/mx.controls:Tree::initListData()
          at mx.controls::Tree/mx.controls:Tree::makeListData()
          at mx.controls::List/mx.controls:List::setupRendererFromData()
          at mx.controls::List/mx.controls:List::commitProperties()
          at mx.controls::Tree/mx.controls:Tree::commitProperties()
          at mx.core::UIComponent/validateProperties()
          at mx.managers::LayoutManager/::validateProperties()
          at mx.managers::LayoutManager/::doPhasedInstantiation()
          at Function/ http://adobe.com/AS3/2006/builtin::apply()
          at mx.core::UIComponent/::callLaterDispatcher2()
          at mx.core::UIComponent/::callLaterDispatcher()

          I'll resurrect this thread to see if it gets some traction now.