Solved

check if user clicked on any radio button

Posted on 2011-09-17
4
461 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

861 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