Flex4学习笔记 checkBox RadioButton DropDownList colorPicker

Posted on 2013-07-24 15:36  诸葛小北  阅读(380)  评论(0编辑  收藏  举报
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
  <fx:Script>
      <![CDATA[
          import mx.controls.Alert;
          public function showMsg(msg:String):void
          {
              Alert.show(msg);
          }
      ]]>
  </fx:Script>
   <fx:Declarations>
       <s:RadioButtonGroup id="Spam" itemClick="showMsg('User picked'+event.currentTarget.selectedValue)"/>
   </fx:Declarations>
<s:Panel width="400" height="150" title="选单控件" horizontalCenter="0" verticalCenter="0">
    <s:layout>
        <s:VerticalLayout/>
    </s:layout>
    <s:HGroup>
        <s:Label text="你的习惯:"/>
        <s:CheckBox id="cbVideoGames" label="光盘游戏" click="showMsg('光盘游戏是 '+ cbVideoGames.selected)"/>
        <s:CheckBox id="cbFishing" label="钓鱼" click="showMsg('钓鱼是') + cbFishing.selected"/>
    </s:HGroup>
    <s:HGroup>
        <s:Label fontWeight="bold" text="你喜欢罐头吗?"/>
        <s:RadioButton id="rbYes" value="Yes" groupName="罐头" click="showMsg('是')" label="是"/>
        <s:RadioButton id="rbNo" value="No" groupName="罐头" click="showMsg('否')" label="否"/>
    </s:HGroup>
    <s:HGroup>
        <s:Label fontWeight="bold" text="最爱的车:"/>
        <s:DropDownList id="combo" close="showMsg('最爱的车是  :  '+ event.currentTarget.selectedItem)">
            <mx:ArrayCollection>
                <fx:String>法拉利</fx:String>
                <fx:String>宝马</fx:String>
                <fx:String>奔驰</fx:String>
            </mx:ArrayCollection>
        </s:DropDownList>
        <s:Label fontWeight="bold" text="喜欢的颜色"/>
         <mx:ColorPicker id="clr" change="showMsg('颜色是'+ event.currentTarget.selectedColor)" />
    </s:HGroup>
    
</s:Panel>
</s:Application>
View Code

 checkBox RadioButton DropDownList  colorPicker

 

Copyright © 2024 诸葛小北
Powered by .NET 8.0 on Kubernetes