Wednesday, 17 March 2010

enable or disable buttons in a mx:ButtonBar

I can't believe there isn't actual support for this built in to the component, but I have come up with a 'cunning hack' which gets around the limitation of the mx:ButtonBar in which it is not possible to bind the enabled state of it's buttons:


So the object's "toolTip", "label" and "icon" properties get propagated through to the buttons added to the button bar, but the enabled property does not. The code above simply fools the binding in to action by calling a method as part of the bind. When the property changes, that method will get called again and the button's enabled state will be set correctly.

No comments: