RadioButton click event : RadioButton « Components « Flex





RadioButton click event

RadioButton click event
  
<?xml version='1.0' encoding='UTF-8'?>
<mx:Application
     xmlns:s="library://ns.adobe.com/flex/spark" 
     xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        import mx.controls.Alert; 
        public function showMsg(msg:String):void { 
            Alert.show(msg); 
        }
    </mx:Script>
    <mx:RadioButtonGroup id="myRadioButtonGroup" itemClick="showMsg('User picked ' + event.currentTarget.selectedValue)" />
    <mx:Panel width="400" height="150" title="Profile" horizontalCenter="0" verticalCenter="0">
        <s:HGroup>
            <mx:Label text="Your hobbies:" />
            <mx:CheckBox id="cbVideoGames" label="Video Games"
                click="showMsg('Video Games is ' + cbVideoGames.selected)" />
            <mx:CheckBox id="cbFishing" label="Fishing"
                click="showMsg('Fishing is ' + cbFishing.selected)" />
        </s:HGroup>
        <s:HGroup>
            <mx:Label fontWeight="bold" text="Do you like spam:" />
            <mx:RadioButton id="rbYes" value="Yes" groupName="myRadioButtonGroup"
                click="showMsg('Yes')" label="Yes" />
            <mx:RadioButton id="rbNo" value="No" groupName="myRadioButtonGroup"
                click="showMsg('No')" label="No" />
        </s:HGroup>

    </mx:Panel>
</mx:Application>

   
    
  










Related examples in the same category

1.Add RadioButton to RadioButtonGroupAdd RadioButton to RadioButtonGroup
2.RadioButton default valueRadioButton default value
3.Define RadioButton control with Define RadioButton control with <mx:RadioButton>
4.Create RadioButton group using the RadioButtonGroup controlCreate RadioButton group using the RadioButtonGroup control
5.Bind bindable variable to RadioButtonBind bindable variable to RadioButton
6.Bind RadioButton to ModelBind RadioButton to Model
7. and three <mx:RadioButtonGroup/> and three <mx:RadioButton/>
8.Change Image value by using RadioButtonChange Image value by using RadioButton
9.Create a RadioButtonGroup and put RadioButton into itCreate a RadioButtonGroup and put RadioButton into it
10.Use radio button to change stateUse radio button to change state
11.Use style to change font size and weight for RadioButton and LabelUse style to change font size and weight for RadioButton and Label
12.RadioButton with group nameRadioButton with group name