Certinaly nothing wrong with that approach. Another way to do it would be a switch statement in a single function that used the id to choose the calculations.
Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Mark Carter Sent: Saturday, November 22, 2008 3:36 AM To: [email protected] Subject: RE: [flexcoders] Best practice for databinding with MenuBar? Oh, I see - its a simple as: for each (var menuitem:XML in menuitemsXML..menuitem) { var id:String = [EMAIL PROTECTED]; var allowFuncName:String = "allow" + id.substring(0, 1).toUpperCase() + id.substring(1); if (hasOwnProperty(allowFuncName)) { [EMAIL PROTECTED] = this[allowFuncName](); } } Any thoughts on whether this is a good approach or not? Mark Carter wrote: > > How can I call the allowX() function where X is a string stored in a var? > -- View this message in context: http://www.nabble.com/Best-practice-for-databinding-with-MenuBar--tp2062 2610p20634401.html <http://www.nabble.com/Best-practice-for-databinding-with-MenuBar--tp206 22610p20634401.html> Sent from the FlexCoders mailing list archive at Nabble.com.

