PDA

View Full Version : Hiding radio buttons


mea
06-01-2005, 09:23 PM
Hi! I'm creating a dynamic quiz in Flash. That is, Flash is reading the questions from an XML file, and displaying them as dynamic text on the stage.

I have multiple choice and true/false questions sharing the same form on the stage. (I figured a true/false question was the same as m/c, with only 2 options.) To hide the extra buttons, I have the following ActionScript code on the frame:

if (choice2text == undefined) {
Choice2.visible = false;
} else {
Choice2.visible = true;
}

However, the Choice2 radio button still displays (with no text). When I move to the next T/F question, the buttons display properly (no Choice2). And if I move backwards to this first T/F question, the buttons now display properly (no Choice2). What gives? Why don't the buttons display properly all the time? Thanks!

** Mea :confused:

CyanBlue
06-01-2005, 11:20 PM
Howdy and Welcome... :)

visible requires _ in front like this...

Choice2._visible = false;

If that somehow does not work, try to change the location to off stage area like this...

Choice2._x = 1000;

deadbeat
06-01-2005, 11:29 PM
.visible should work for components without the underscore...

Are you sure your radio buttons have the right instance names?

K.

CyanBlue
06-01-2005, 11:32 PM
That must be the V2 thing that I have no idea about then... :D

mea
06-02-2005, 03:32 AM
Thanks for your suggestions. I'm positive I have the right instance names. The Properties inspector shows "Choice2 .. Instance of: RadioButton". So my instance names and code syntax are right, and the code works most of the time. Why would it not work all of the time? Does it have anything to do with how the objects on the stage load?

** Mea :(