Thanks for that Tracy - interesting approach and could be exactly what I need.
I use fairly strict naming standards: <menuitem id="firstAction" label="First Action" enabled="{allowFirstAction()}"/> So, if I use your approach, then I would remove the enabled attribute and, instead, in actionscript do something like: menuItemsXML..menuitem.(@id == firstAction)[EMAIL PROTECTED] = allowFirstAction(); As you can imagine, I have lots of these enabled attributes to set. How can I call the allowX() function where X is a string stored in a var? So I can do something like this to call all allowX() methods: for each (var menuitem:XML in menuitemsXML..menuitem) { var id:String = [EMAIL PROTECTED]; var allowFunc:Function = <!-- something like getFunction("allow" + id.substring(0, 1).toUpperCase() + id.substring(1)) --> [EMAIL PROTECTED] = allowFunc(); } That would be really powerful. Tracy Spratt wrote: > > I do not use binding to change dataProvider property values. Rather, I > use an e4x expression to locate the desired node(s), then directly set > the property values I want. > > Tracy > > > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of Mark Carter > Sent: Friday, November 21, 2008 9:51 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Best practice for databinding with MenuBar? > > > > > I have a MenuBar where the dataProvider is specified in MXML as an > XMLList. > > For the "enabled" attributes I do something like: > > enabled="{allowThis()}" > > However, to get databinding working I end up passing in the relevant > bindable property and then ignore it within the implementation of > allowMe(). > For example: > > enabled="{allowThat(myBindableVar)}" > > This works, but IMHO is horrible because it requires either messing up > my > API or creating a load of functions like: > > function allowThat(myBindableVar:Object):Boolean { > allowThis(); > } > > Is there another approach? A standard approach? > > As another workaround, maybe there is a way to recalculate the enabled > flags > for the whole MenuBar? Maybe resetting the dataProvider? > -- > View this message in context: > http://www.nabble.com/Best-practice-for-databinding-with-MenuBar--tp2062 > 2610p20622610.html > <http://www.nabble.com/Best-practice-for-databinding-with-MenuBar--tp206 > 22610p20622610.html> > Sent from the FlexCoders mailing list archive at Nabble.com. > > > > > -- View this message in context: http://www.nabble.com/Best-practice-for-databinding-with-MenuBar--tp20622610p20633249.html Sent from the FlexCoders mailing list archive at Nabble.com.