Flash RadioButton Component ActionScript 3 Tutorial
This Flash Component tutorial series show how to use Radio Button with Flash ActionScript 3.
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 {
radioboxValue_txt.text = "You select " + String(fruitRadioGroup.selectedData) + " and confirm by Enter button.";
}
fruitRadioGroup.addEventListener(MouseEvent.CLICK, selectFruit);
function selectFruit(evt:MouseEvent):void {
if (String(fruitRadioGroup.selectedData) == "Orange") {
radioboxValue_txt.text = String(fruitRadioGroup.selectedData);
}
Download Flash Source File:
Remarks:
This Flash ActionScript tutorial shows how to use Flash RadioButton component.