Groups | Blog | Home
all groups > flash data integration > may 2005 >

flash data integration : Radio buttons in Flash MX


XariusCain
5/31/2005 12:00:00 AM
If I understand you correctly, you're trying to put 3 questions on a page at
once?
1. Is this right?
O Yes
O No

2. Where did the name Radio button come from, anyway?
O Fiji
O They resemble buttons on old fashion radios
O That data is irrelevant

3. Question?
O True
O False

What you need to do is put the different answers in groups using the component
inspector. For each button, you will find an entry called groupName. What
you'd do in this particular case would be to select the first two buttons
('Yes' and 'No') and assign their group name to be something like 'question1'.
Then select the next 3 buttons ('fiji', 'they resemble...', and 'that data...')
and put them in a different group (we'll call ours 'question2'). Assign the
true/false buttons to a third group 'question3' and you're good to go.
xarc
5/31/2005 8:05:06 AM
Hi all, i am setting up a flash game and we are passing info back to our server
and we are having no trouble passing names and addresses and data like that but
we are having trouble with the some questions we have built into the game we
want to use radio buttons to answer yes or no to certain questions. when i drag
the radio buttons onto the stage they work fine but the problem is that we can
only tick one at a time and we need to answer three questions so we need to
have three radio buttons ticked. the player can only proceed to the next screen
when the questions are answered and the details are correct. has anyone any
idea how i set up the radio buttons as groups for each of the three questions.
what am i doing wrong. any help greatly appreciated. Thanks in
advance.:brokenheart;
Pat D.
6/1/2005 12:00:00 AM
I use the attached code to create and watch some buttons.


var wear_ar:Array = ["any","400","300","200","100"];
var varname:String="";
var ypos:Number=lr+cb_y;
for (var i=0; i<wear_ar.length; i++) {
varname = "wear"+(i+1)+"_ch";
this.createObject("RadioButton",varname,_root.getNextHighestDepth());
if (wear_ar[i] != "any") this[varname].label = wear_ar[i] + " up"
else this[varname].label = wear_ar[i];
this[varname].data = wear_ar[i];
this[varname].groupName = "wearGroup";
this[varname].move(w_x,ypos);
this[varname].setSize(53,cb_y);
ypos += cb_y;
}
wear1_ch.data = "";
wear1_ch.selected = true;

buttWatch = new Object();
buttWatch.click = function (btn:Object):Void {
_level0.vWear.data = btn.target.selection.data;
}
wearGroup.addEventListener("click",buttWatch);
AddThis Social Bookmark Button