PDA

View Full Version : Wrong string displaying



cturner
March 30th, 2003, 08:23 AM
I am creating a Noughts and Crosses game with radio buttons, 9 buttons and 9 dynamic text boxes. The code below is on a button that when a player clicks on that button it is suppose to display whichever radio button is selected and the problem is that it displays 0 even when X is selected. See the comments in the code for more information.


on(release) {
// checking radio button X is selected
if (X_rb.getValue()==true) {
// displaying X in a text box
lbl1 = "X";
// disabling button after been clicked on
Button1.enabled = false;
// if radio button X isn't selected then 0 must be
} else {
// displaying 0 in a text box
lbl1 = "0";
// disabling button after been clicked on
Button1.enabled = false;
}
}

eyezberg
March 30th, 2003, 01:30 PM
did you trace(X_rb.getValue()); ?
also, move
Button1.enabled = false;
out of the if(){}else(){} to here
coz it's executed anyway,
no need to have it twice..
and in MX, you should use
lbl1.text = "X";
//not variable, but textfield instance name