Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

check if user clicked on any radio button

Posted on 2011-09-17
4
Medium Priority
?
467 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

916 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