Flash AS3 Tutorials Center | Interesting Flash Animation Tutorials | Valuing Flash Animation Tutorials | Flash ActionScript and Animation Home

AS3 Beginner Tutorials | AS3 Basic Lessons | AS3 Valuing Courses | AS3 Components Tutorials | AS3 and PHP Interaction Tutorials
AS3 Practical Tutorials | AS3 Animation Techniques | AS3 Transition Effects Tutorials | AS3 Download Upload Files | AS3 Particle Systems
Communication Between Flash Movies with AS3 | AS3 and JavaScript interaction | AS3 Matrix Transformation | AS3 Physics Simulation Tutorials

Flash RadioButton Component ActionScript 3 Tutorial

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

Please update flash player to view this Flash ActionScript tutorial!

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.