开发者

How to enable/disbale a button in mxml depending on whether count is less than 10 or not

I am trying to bind enabled property of my button to the maximum value that an integer can attain. I need this button to allow user to view next page and want to disable this button when all the components have been shown (as reflected in count).

Something like :

<mx:Button label="Previous" click="nextHandler()" enabled="{count< 10}">

But the compiler is throwing an err开发者_运维问答or that '<' attribute can not be used in enabled tag.

Any ideas over this ?

Thanks in advance.


The following will work:

<mx:Button label="Previous" click="nextHandler()" enabled="{count &lt; 10}"/>

Just tested it with:

    <s:NumericStepper id="count"/>
    <mx:Button label="Previous"  enabled="{count.value &lt; 10}"/>  


Adrnans answer is spot on, but if you dont wish to use the XML/Html "&lt"; then the following also works:)

<mx:NumericStepper id="count" x="10" y="15" maximum="20"/>
<mx:Button label="Previous" enabled="{count.value >= 10 ? false : true}" x="10" y="45"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜