Solved

check if user clicked on any radio button

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
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 what frame rate is, how to control it and what effect it has on the video.

863 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

24 Experts available now in Live!

Get 1:1 Help Now