我可以将Flex组件属性绑定到函数吗?
发布时间:2020-12-15 02:16:35 所属栏目:百科 来源:网络整理
导读:我想根据具有一个或多个参数的函数的返回值在按钮上设置enabled属性.我怎样才能做到这一点? private function isUserAllowed (userName:Boolean):Boolean { if (userName == 'Tom') return true; if (userName == 'Bill') return false;}mx:Button label="C
|
我想根据具有一个或多个参数的函数的返回值在按钮上设置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)}"
>
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
