
转载请保持文章完整性!
本文链接地址:http://blog.desizen.com/4lone/303.html
主页:joel's blog
这个例子进行的是UI Controls:Data Entry Controls:RadioButton
简介:
The RadioButton control lets the user make a single choice within a set of mutually exclusive choices. A RadioButton group is composed of two or more RadioButton controls with the same groupName property. The RadioButton 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 RadioButton 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, TourDeFlex, 例子

ActionScript 怎么单选组的值?
可否详细的说一下?