首页» FLEX »FLEX例子之单项选择按钮(RadioButton)

FLEX例子之单项选择按钮(RadioButton)

立即注册PayPal并开始接受信用卡付款。
转载请保持文章完整性!
本文链接地址:http://blog.desizen.com/4lone/303.html
主页:joel's blog

这个例子进行的是UI Controls:Data Entry Controls:
简介:
The control lets the user make a single choice within a set of mutually exclusive choices. A group is composed of two or more controls with the same groupName property. The group can refer to a group created by the RadioButtonGroup tag. The user selects only one member of the group at a time. Selecting an unselected group member deselects the currently selected control within that group.
例子:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" verticalAlign="middle"
    horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]" viewSourceURL="srcview/index.html">
    <!--这个例子是一个单选按钮的例子,使用数组来动态添加数据到Text标签,用到的技术就是固定的显示需要变换的数据的前后数据-->
    <mx:Script>
        <![CDATA[
 
            private var statement:Array = ["I","love Flex."];//设置数组
 
            private function displayAnswer(txt:String):void{
                answer.htmlText = statement[0] + " <u>" + txt + "</u> " + statement[1];
            }
        ]]>
    </mx:Script>
 
    <mx:Panel title="RadioButton" layout="vertical" color="0xffffff" borderAlpha="0.15"
         paddingTop="10" paddingRight="10" paddingBottom="10" paddingLeft="10" horizontalAlign="center">
 
        <mx:Text color="0x323232" fontWeight="bold" text="Which word best completes the statement below?" />
 
        <mx:VBox>
            <mx:RadioButton groupName="survey" id="word1" label="totally" color="0x323232" click="displayAnswer(word1.label);" /> 
            <mx:RadioButton groupName="survey" id="word2" label="do" color="0x323232" click="displayAnswer(word2.label);" />
            <mx:RadioButton groupName="survey" id="word3" label="kind of" color="0x323232" click="displayAnswer(word3.label);" />
            <mx:RadioButton groupName="survey" id="word4" label="do not" color="0x323232" click="displayAnswer(word4.label);" />
        </mx:VBox>
 
        <mx:Text id="answer" fontSize="16" fontWeight="bold" color="0x0050AA" creationComplete="displayAnswer('     ');" /><!--creationComplete当事件完成构造时执行-->
    </mx:Panel>
</mx:Application>

标签:, , ,

与"FLEX例子之单项选择按钮(RadioButton)"相关的文章:

2 条评论 »

  1.  匿名 Says:

    ActionScript 怎么单选组的值?

    • joel  says:

      可否详细的说一下?

留下评论

emoticons

Feedback Form