RadioButton in Flex4

In Flex4 RadioButton is a spark component. You can use two or more RadioButton components with in a RadioButtonGroup and select only one RadioButton at one time and if one stands in selected mode then all will be in deselected state because it is mutually exclusive with in a group

 
 

Share on Google+Share on Google+

RadioButton in Flex4

Ads

In Flex4 RadioButton is a spark component. You can use two or more RadioButton components with in a RadioButtonGroup and select only one RadioButton at one time and if one stands in selected mode then all will be in deselected state because it is mutually exclusive with in a group

RadioButton in Flex4:

In Flex4 RadioButton is a spark component. You can use two or more RadioButton components with in a RadioButtonGroup and select only one RadioButton at one time and if one stands in selected mode then all will be in deselected state because it is mutually exclusive with in a group. You can give the same groupName property to two or more RadioButton components which is in the same RadioButtonGroup. The minimum size of the RadioButton is 18*18 pixels and maximum size 10000*10000 pixels. The tag of RadioButton is <s:RadioButton/>.

Example:

 <?xml version="1.0"?>

<!-- Radiobutton control Example -->

<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/halo">

<fx:Script>

<![CDATA[

import flash.events.Event;

private function pickcolor(event:Event):void

{

if(radbtn1.selected==true){

txtArea.text="You choose a Red color";

}

if(radbtn2.selected==true){

txtArea.text="You choose a Blue color";

}

if(radbtn3.selected==true){

txtArea.text="You choose a Green color";

}

}

]]>

</fx:Script>

<s:Panel title="Radiobutton control Example" width="386" height="147" color="#990000">

<s:HGroup paddingLeft="10" paddingTop="10" height="103" width="357">

<s:VGroup>

<s:Label text="Select a Color" fontSize="12" fontWeight="bold" color="Blue" width="142" height="13"/>

<s:RadioButton groupName="techGroup"

id="radbtn1"

label="Red"

width="150"

click="pickcolor(event);" color="#990000"/>

<s:RadioButton groupName="techGroup"

id="radbtn2"

label="Blue"

width="150"

click="pickcolor(event);" color="#990000"/>

<s:RadioButton groupName="techGroup"

id="radbtn3"

label="Green"

width="150"

click="pickcolor(event);" color="#990000"/>

</s:VGroup>

<s:TextArea id="txtArea" color="Green" height="87"/>

</s:HGroup>

</s:Panel>

</s:Application>

Output:


Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

Download this code

Advertisements

Posted on: April 21, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles