Home | Contact Us | Store

Flash RadioButton Component ActionScript 3 Tutorial

This Flash Component tutorial series show how to use Radio Button with Flash ActionScript 3.

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 RadioButton component lets you force a user to make a single selection from a set of choices. This Flash component must be used in a group of at least two RadioButton instances. Only one member of the group can be selected at any given time.

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

Flash ActionScript Codes:

//Set the Apple RadioButton to be selected by default
apple_rb.selected = true;

//Declare the Radio group (belong to same group)
//This can be done by using the first RadioButton (apple_rb)
var fruitRadioGroup:Object = apple_rb.group;

enter_btn.addEventListener(MouseEvent.CLICK, enterTheFruit);

 

function enterTheFruit(evt:MouseEvent):void {

//Disply message on the "Value of RadioBox" TextField
radioboxValue_txt.text = "You select " + String(fruitRadioGroup.selectedData) + " and confirm by Enter button.";

}

 

fruitRadioGroup.addEventListener(MouseEvent.CLICK, selectFruit);

 

function selectFruit(evt:MouseEvent):void {

//Disply message on the Message Box
if (String(fruitRadioGroup.selectedData) == "Orange") {
output_txt.text = "Yeah..." + String(fruitRadioGroup.selectedData) + " is my favorite fruit!";} else {output_txt.text = "You select " + String(fruitRadioGroup.selectedData);}//Show value of RadioBox on the "Value of RadioBox" TextField
radioboxValue_txt.text = String(fruitRadioGroup.selectedData);

}

Download Flash Source File:

Flash Source File radiobutton.fla

Remarks:

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

ActionScript Component Control Tutorial