Re: [Flashcoders] adding value of radiobutton to number in resultTxt.text field.. help please

2008-05-20 Thread Hans Wichman
Hi,

read a programming or flash manual, or subscribe to the newbie list.
This is not meant harshly but these questions are so basic that you
are doing yourself (and us) a favor by sharpening your axe before you
set off in the woods.

You do:
>resultTxt.text = parseInt(resultTxt.text) + 
> (event.target.selection.value).toString();

as in:
string = number + string

so yeah an implicit type cast will occur, appending your string to
your number. If you want to add them make sure you do:
string = ""+ (number+number);

regards,
JC


On Tue, May 20, 2008 at 3:07 AM, rlyn ben <[EMAIL PROTECTED]> wrote:
> how can i add a radiobutton value from the number at resultTxt.text... here 
> is my code.. it wont do the math.. all it does is puts the value right beside 
> the numbers at resultTxt.text.. help..
>
> stop();
>
> var gRB:RadioButtonGroup = RadioButtonGroup.getGroup("genderGroup");
> gRB.addEventListener(MouseEvent.CLICK, genderHandler);
>
> function genderHandler(event:MouseEvent):void {
>trace("event.target.selection.name", event.target.selection.name);
>trace("event.target.selection.value", event.target.selection.value);
>trace("resultTxt.text", resultTxt.text);
>
>switch(event.target.selection.name) {
>case "maleRB":
>maleRB.value = 1;
>break;
>case "femaleRB":
>femaleRB.value = 0;
>break;
>}
>resultTxt.text = parseInt(resultTxt.text) + 
> (event.target.selection.value).toString();
> }
>
>
>
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] adding value of radiobutton to number in resultTxt.text field.. help please

2008-05-19 Thread rlyn ben
how can i add a radiobutton value from the number at resultTxt.text... here is 
my code.. it wont do the math.. all it does is puts the value right beside the 
numbers at resultTxt.text.. help.. 

stop();

var gRB:RadioButtonGroup = RadioButtonGroup.getGroup("genderGroup");
gRB.addEventListener(MouseEvent.CLICK, genderHandler);

function genderHandler(event:MouseEvent):void {
trace("event.target.selection.name", event.target.selection.name);
trace("event.target.selection.value", event.target.selection.value);
trace("resultTxt.text", resultTxt.text);

switch(event.target.selection.name) {
case "maleRB":
maleRB.value = 1;
break;
case "femaleRB":
femaleRB.value = 0;
break;
}
resultTxt.text = parseInt(resultTxt.text) + 
(event.target.selection.value).toString();
}



  
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders