我想根据具有一个或多个参数的函数的返回值在按钮上设置enabled属性.我怎样才能做到这一点?
private function isUserAllowed (userName:Boolean):Boolean { if (userName == 'Tom') return true; if (userName == 'Bill') return false; } <mx:Button label="Create PO" id="createPOButton" enabled="<I want to call isUserAllowed ('Bill') or isUserAllowed ('Tom') here>" click="createPOButton_Click()" />
解决方法
<mx:Button enabled = "{this.myFunction(this.myVariable)}" >
或内联:
<mx:Button enabled = "{(function(arg:Object):Boolean{ ... })(this.myVariable)}" >