Flex中如何通过enabled属性在RadioButtonGroup中将所有的RadioButton设置为有效或无效状态的例子

By Minidxer | June 21, 2008

接下来的例子演示了Flex中如何通过设置enabled属性,在RadioButtonGroup中将所有的RadioButton设置为有效或无效状态。

让我们先来看一下Demo(可以右键View Source或点击这里察看源代码):


下面是完整代码(或点击这里察看):

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  3.         layout="vertical"
  4.         verticalAlign="middle"
  5.         backgroundColor="white">
  6.  
  7.     <mx:ApplicationControlBar dock="true">
  8.         <mx:Form styleName="plain">
  9.             <mx:FormItem label="enabled:">
  10.                 <mx:CheckBox id="checkBox"
  11.                         selected="true" />
  12.             </mx:FormItem>
  13.         </mx:Form>
  14.     </mx:ApplicationControlBar>
  15.  
  16.     <mx:RadioButtonGroup id="radioGroup"
  17.             enabled="{checkBox.selected}" />
  18.  
  19.     <mx:VBox horizontalAlign="left">
  20.         <mx:RadioButton id="radioButton1"
  21.                 label="Red"
  22.                 group="{radioGroup}" />
  23.         <mx:RadioButton id="radioButton2"
  24.                 label="Orange"
  25.                 group="{radioGroup}" />
  26.         <mx:RadioButton id="radioButton3"
  27.                 label="Yellow"
  28.                 group="{radioGroup}" />
  29.         <mx:RadioButton id="radioButton4"
  30.                 label="Green"
  31.                 group="{radioGroup}" />
  32.         <mx:RadioButton id="radioButton5"
  33.                 label="Blue"
  34.                 group="{radioGroup}" />
  35.     </mx:VBox>
  36.  
  37. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:minidxer

Topics: Flex | Tags: , ,

Related Post

21 comments | Add One

  1. 一亿度 - 06/21/2008 at 4:07 pm

    楼主用来显示源代码的插件很不错!是哪个插件啊,能否透露下~btw,沙发,嘿嘿

  2. Minidxer - 06/21/2008 at 4:11 pm

    coolcode,我自己做了一些修改
    专业性太强范围太小,这里留言的人很少的,基本上你想的话都可以坐到沙发的,呵呵。

  3. opera - 06/21/2008 at 5:31 pm

    看来今天沙发没坐到 做个地板吧 :)

  4. Minidxer - 06/21/2008 at 5:58 pm

    呵呵,opera 爬山回来还有力气上网阿~

  5. 一亿度 - 06/21/2008 at 6:15 pm

    opera.name,这个域名够强悍!

  6. Minidxer - 06/21/2008 at 7:03 pm

    就是啊,太强悍了,opera把这个域名拿出来卖吧~ :)

  7. opera - 06/21/2008 at 8:41 pm

    刚回来,呵呵 上网小歇一会。
    晚上吃了骨头汤,哇塞 太油了~~~
    ps:你们觉得opera.name这个好啊,我觉得是没人要我才住了的:(

  8. Minidxer - 06/21/2008 at 8:47 pm

    “没人要我才住了的”。。。
    拿着宝贝当废铁啊~ 开价吧,我买了~ 呵呵,废铁价哦

  9. opera - 06/22/2008 at 11:54 am

    哈哈 1米 怎么样

  10. Minidxer - 06/22/2008 at 7:53 pm

    1米好啊,成交了? 留下你的paypal或者支付宝, 呵呵

  11. 一亿度 - 06/23/2008 at 8:10 pm

    晕,这么便宜?我出1.01米~

  12. Minidxer - 06/23/2008 at 8:11 pm

    我先预定的阿,居然和我抢。。。
    我出10米~

  13. opera - 06/25/2008 at 2:15 pm

    我来咯。 这两天工作很忙,都没时间过来转悠转悠。你们也忙吧。

  14. Minidxer - 06/25/2008 at 2:19 pm

    我们就等着你交出 http://www.opera.name/ 呢。。。

  15. opera - 06/25/2008 at 2:23 pm

    哈哈 咱们3个人到冬天的时候 来个打血仗。谁打赢了 谁就是胜利者 :)

  16. opera - 06/25/2008 at 2:24 pm

    :( 血? 受不了 是雪

  17. Minidxer - 06/25/2008 at 2:26 pm

    “打血仗”。。。
    今年冬天未必下雪吧。

  18. opera - 06/25/2008 at 2:33 pm

    今年 说不准。 因为夏天的时候都不怎么热。估计冬天 还会下雪。

    @Minidxer
    问你一个技术问题啊。EXCEL数据导入MYSQL有什么好的办法啊?

  19. Minidxer - 06/25/2008 at 2:36 pm

    google了一下,不知是否有帮助:
    1.将选中的数据快儿拷贝到一个TXT文本文件中(记得把后面的空格消掉。。),假如存到“D:\data.txt”这个位置里。
    2.根据要导入的数据快儿建立MySql数据库和表,然后进入命令提示符里使用命令
    load data local infile ‘D:\data.txt’ into table exceltomysql fields terminated by ‘\t’;
    进行导入操作

    具体操作在这里(图文并茂): http://hi.baidu.com/harite/blog/item/6a5fb9de55e6f258ccbf1adf.html

  20. opera - 06/25/2008 at 2:39 pm

    这个我看过了,感觉到有点麻烦,还要写语句。有没有一种软件直接可以进行两者导入导出。这样才牛 呵呵

Trackbacks

Leave a Comment

Name(*):

E-Mail(*) :

Website :

Comments :

Search Posts

Archives

Sponsored Ads