0

Ey guys,

I want to disable specific nodes in a mx:Tree component.

The dataprovider is a XML file, and here is a sample of that menu:

<nav>
    <menu label="Menu" action="" item="">
        <menu label="Item 1" action="image" item="image.png" />
        <menu label="Item 2" action="disabled" item=" " />
    </menu>
</nav>

In the above example, you will get a simple menu item with two childs. I want to disable the second child (if action is set to disabled...)

How can I do this?

All I need is to simply change the font color of those items, or to make the alpha 0.5. If its possible to also disable the clicking, then thats good, but the main focus is giving them different color or opacity.

Any help is appreciated! :)

Thanks! :)

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Stian Berg Larsen
  • 543
  • 2
  • 10
  • 29

1 Answers1

0

Basically that's how item renderer should looks like. However it's not going to work with xml dataprovider. I recommend you to to use collection of objects then it will work fine.

<?xml version="1.0"?>
<s:MXTreeItemRenderer xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:fx="http://ns.adobe.com/mxml/2009"
                      enabled="{data.action != 'disabled'}">

    <s:Label text="{data.label}"
             color="{data.action != 'disabled'? 0x000000:0xff0000}"/>
</s:MXTreeItemRenderer>