Solved

check if user clicked on any radio button

Posted on 2011-09-17
4
457 Views
Last Modified: 2012-05-12
I have a form with different radio button groups (ex. basic, collision, theft, etc...), and each has two options (y/n), and I want to perform a subroutine when the user CLICKS ON ANY of the groups. I wouldn't like to check FOR EACH PAIR OF VALUES IN A GROUP.
I have GBASIC (group name)
GCOLLISION (group name)
GTHEFT (group name)
etc...

How can I accomplish this ?

Thanx

I am using CS3 and AS2
0
Comment
Question by:crescue
4 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36554542
Pls show some html or a picture. Your request is not clear
0
 

Author Comment

by:crescue
ID: 36554594
I want to do a subroutine when the user CLICKS ON ANY Coverage option
options.JPG
0
 
LVL 1

Expert Comment

by:ChrisKitching
ID: 36554667
You're not being very clear in what you want. Which flash language is this? The RadioButton class does have an event for when it is clicked on (To provide specifics I need to know if this is AS3, AS2, or MXML (And if so which Flex SDK)).
If you want to perform your check when the form is submitted, just use a logical or on the options using the selected property of the RadioButtons and the || operator.
0
 
LVL 29

Accepted Solution

by:
dgofman earned 500 total points
ID: 36555419
I can see you are using CS3. The best way you may need to use RadioButtonGroup

Check these examples

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/controls/RadioButton.html#group

import fl.controls.RadioButton;
import fl.controls.RadioButtonGroup;

var myRadioGroup:RadioButtonGroup = new RadioButtonGroup("options");
myRadioGroup.addEventListener(Event.CHANGE, changeHandler);

var radio1:RadioButton = new RadioButton();
radio1.label = "Option A";
radio1.value = "optionA";
radio1.group = myRadioGroup;
radio1.move(10, 10);
addChild(radio1);

var radio2:RadioButton = new RadioButton();
radio2.label = "Option B";
radio2.value = "optionB";
radio2.group = myRadioGroup;
radio2.move(10, 30);
addChild(radio2);

var radio3:RadioButton = new RadioButton();
radio3.label = "Option C";
radio3.value = "optionC";
radio3.group = myRadioGroup;
radio3.move(10, 50);
addChild(radio3);

function changeHandler(event:Event):void {
    var rbg:RadioButtonGroup = event.target as RadioButtonGroup;
    if (rbg.selectedData != null) {
        trace(rbg.selectedData);
    } else {
        trace("no value specified.");
    }
}



0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now