Can I add a disabledIcon to a Flex Menu for use in PopUpButton
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
.
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.
精彩评论