Disable individual buttons in a buttonbar

匿名 (未验证) 提交于 2019-12-03 00:57:01

问题:

How can I disable a single button in a buttonbar in Flex?

回答1:

here is the sample app.

<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"     creationComplete="onComplete();">     <mx:Script>         <![CDATA[             import mx.controls.Button;             private function onComplete():void {                 for ( var i:int=0; i<btns.numChildren; i++ ) {                     if ( i == 0 || i % 2 == 0 ) {                         Button(btns.getChildAt(i)).enabled = false;                     }                 }             }         ]]>     </mx:Script>     <mx:LinkBar id="btns">         <mx:dataProvider>             <mx:ArrayCollection>                 <mx:Array>                     <mx:Object label="Button 1" />                     <mx:Object label="Button 2" />                     <mx:Object label="Button 3" />                     <mx:Object label="Button 4" />                     <mx:Object label="Button 5" />                     <mx:Object label="Button 6" />                 </mx:Array>             </mx:ArrayCollection>         </mx:dataProvider>     </mx:LinkBar> </mx:WindowedApplication> 

Basically you access individual buttons using

libkBarInst.getChildAt(n) 

which gives you a Button. Hope that helps.



回答2:

Check this post Disabling individual buttons on a Flex ButtonBar control



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!