Home | Contact Us | Store

Flash CheckBox Component ActionScript 3 Tutorial

This Flash Component tutorial series show how to use some common components with ActionScript 3. If you did some programming before, you must be very familiar with the component control - Check Box, Radio Button, Combo Box, List Box and may be Progress Bar.

Flash ActionScript component control tutorial example display here. Your flash player version is too old to see this Flash tutorial example!

Flash Tutorial Content:

The Flash CheckBox component displays a small box that can contain a check mark. A CheckBox component can also display an optional text label that is positioned to the left, right, top, or bottom of the CheckBox.

The finished Flash Movie of this tutorial is shown as above. Click on the above Flash Movie and play around.

Flash ActionScript Codes:

//Uncomment the following line if you have to create runtime CheckBox
//import fl.controls.CheckBox;

// Declare variable
var checkboxStatus:Boolean;

// Add event listener to checkbox
myCheckBox.addEventListener(Event.CHANGE, checkboxChange);

 

function checkboxChange(evt:Event) {

// checkbox status (checked = true, unchecked = false)
// evt.target is [object CheckBox]
checkboxStatus = evt.target.selected ;

if (checkboxStatus == true) {
checkbox_txt.text = "You checked me ON!";
output_txt.text = "";
} else {checkbox_txt.text = "You checked me OFF!";
output_txt.text = "";
}

}

 

function checkStatus(evt:MouseEvent):void {

if (myCheckBox.selected == true) {output_txt.text = "Checkbox is checked ON";} else {output_txt.text = "Checkbox is checked OFF";}

}

 

blueButton_btn.addEventListener(MouseEvent.CLICK, checkStatus);

Download Flash Source File:

Flash Source File checkbox.fla

Remarks:

This Flash ActionScript tutorial shows how to use Flash Checkbox component.

ActionScript Component Control Tutorial