Skip to main content
Participant
November 7, 2016
Answered

How to sum values of radiobutton groups in actionscript

  • November 7, 2016
  • 5 replies
  • 396 views

hello all respected members, i am new to actionscript, i want to make a score calculator with radio buttons and radio button groups and want to sum values of selected radio buttons in the score calculator test.Also the risk remarks will bedisplayed according to the value of risks, please help, as i havnt found anything on it .

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer kglad

var obj:Object = {};

var sum:int;

for(var i:int=1;i<=rbNum;i++){

this['rb'+i].addEventListener(MouseEvent.CLICK,f);

}

function f(e:MouseEvent):void{

obj[e.currentTarget.groupName]=e.currentTarget.value;

sum=0

for(var s:String in obj){

sum+=obj;

}

}

5 replies

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
November 7, 2016

var obj:Object = {};

var sum:int;

for(var i:int=1;i<=rbNum;i++){

this['rb'+i].addEventListener(MouseEvent.CLICK,f);

}

function f(e:MouseEvent):void{

obj[e.currentTarget.groupName]=e.currentTarget.value;

sum=0

for(var s:String in obj){

sum+=obj;

}

}

qudsi1Author
Participant
November 9, 2016

Thank you very much, let me implement this

kglad
Community Expert
Community Expert
November 9, 2016

you're welcome.

(p.s when using the adobe forums, please mark helpful/correct responses, if there are any.)