Use CheckBox click event : CheckBox « Components « Flex






Use CheckBox click event

Use CheckBox 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.Set checkbox menu item checkedSet checkbox menu item checked
2.Use to define a CheckBox controlUse <mx:CheckBox> to define a CheckBox control
3.Use selected property to create a checked checkboxUse selected property to create a checked checkbox
4.Use addChildAt() to add the CheckBox control to VBoxUse addChildAt() to add the CheckBox control to VBox
5.A form with a CheckBox controlA form with a CheckBox control
6.CheckBox Item RendererCheckBox Item Renderer
7.Register function to a Button control and CheckBox controlRegister function to a Button control and CheckBox control
8.Use CheckBox to control Button enabled stateUse CheckBox to control Button enabled state
9.CheckBox renderer for DataGridColumnCheckBox renderer for DataGridColumn
10.CheckBox Checked eventCheckBox Checked event
11.Use setChildIndex() to move a CheckBox control down the display listUse setChildIndex() to move a CheckBox control down the display list
12.Using the selected property to generate a checkbox that is checked by defaultUsing the selected property to generate a checkbox that is checked by default
13.Image is not visible until the user selects the checkboxImage is not visible until the user selects the checkbox
14.Inline DataGrid CheckBox EditorInline DataGrid CheckBox Editor
15.Inline DataGrid CheckBox Editor With OffsetsInline DataGrid CheckBox Editor With Offsets
16.CheckBox control named myCB appears when you change to any view state in GroupCheckBox control named myCB appears when you change to any view state in Group
17.ChekcBox with LabelChekcBox with Label