views:

25

answers:

1

I am using the Flex PopUpButton & data binding a Menu object to the popup. I successfully added an icon to a menu item; however, it does not look like Menu supports the disabledIcon property common in many other elements for use when enabled: false for that menu item.

Is it possible to extend the Flex Menu class to use disabledIcon? Should I use a different type of data binding class?

// create the array collection of menu items
var menuItems:ArrayCollection = new ArrayCollection();

var addWidget:Object = new Object();        
addWidget = ({label: "Add",
              id: ADD_WIDGET_ID,
              icon: addIcon,
              disabledIcon: addDisabledIcon,
              enabled: false});
menuItems.addItem(addWidget);

var myMenu:Menu = new Menu();
myMenu.dataProvider = menuItems;

productActionsButton.popUp = myMenu;

The above code will produce a disabled Add menu item where the menu item icon is addIcon instead of the desired addDisabledIcon because Mx:Menu does not currently support disabledIcon.

A: 

I would extend mx.controls.menuClasses.MenuItemRenderer and override the updateDisplayList method to change which icon is shown based on the enabled property. Hope that helps.

Wade Mueller