View Full Version : radio buttons stop responding
ryoaska
05-09-2004, 08:56 PM
hey, i've got a pretty simple problem- but I don't really get why it's happening, so maybe someone can shed some light on this for me.
it boils down to pretty much one thing. If i have a group of radios (radio1, radio2, radio3) in a frame, and the code
stop();
radio2.selected = true;
next_btn.onRelease = function()
{
gotoAndPlay(5);
}
where frame five does nothing but send the playhead back to the original frame- the second time "radio2.selected = true;" is executed it doesn't set the second radio button like it does the first time. Instead all the radio buttons are blank. I just don't get why it would set them the first time it runs that code, but not after that. I'm sure that the code is being executed again evert time i hit "next_btn" becaue i've tested that, so it seems like the radio2 variable stops being connected to the radio button somehow. These are the simplest terms that i have this problem under (obviously i'm not going to another frame for the sole purpose of coming back to the one i just left)- but solving this problem would fix what's wrong with my current project.
-thanks
Viath
05-10-2004, 04:30 AM
Use this instead:
radio2.selected = true;
next_btn.onRelease = function()
{
gotoAndPlay(5);
}
stop();
See if that works. ;)
ryoaska
05-10-2004, 04:42 AM
thanks, but i think the stop statement just stops the playhead, not the actual code execution. (i did try that just in case at some point, but it didn't change anything). All other code i put after the stop statement still executes, i'm just getting no response when refering to my radio buttons any time that frame is reloaded. The same happens if i populate a combo box or listbox component in that frame. It will work the first time, but if it goes to another frame and back again, it acts like it doesn't recognize the variable associated with the component (and i have made sure the variable is in proper scope). the only one i've had success with so far is the text area component
Viath
05-10-2004, 04:53 AM
How about _root.radio2.selected = true?
Viath
05-10-2004, 05:07 AM
BTW, I just tried everything you stated in your original post and it works fine for me.
ryoaska
05-12-2004, 04:00 PM
yeah, I tried _root too and that had no effect... It really doesn't make sense to me, and now that you say it works for you, it makes less sense. I've been really busy lately due to midterms and other school work, so I haven't messed with it in a few days, but I'll try looking at it again and see if I can either figure out what i might be doing differently than you (since you just followed what i put above)- and if theres any other info that might be applicable.
Thanks for your help though-
Tyree G.
ryoaska
05-12-2004, 04:10 PM
oh yeah, here's something that's even more strange to me, but might indicate where my problem is. Before I leave to go to the frame that brings me back to the frame with the radios I have a loop that goes through the radios with a "if root["radio"+i].selected = true..." (yes, that's a stupid way to check which one is selected- this was just for testing). Anyway, the weird thing is- say i select a radio button other than 2 the next time the radio buttons come up. Then when it checks in the loop the next time, the part in the if statement is executed for i = 2 AND i = the number of the radio button I selected next... how is this possible- i'm POSITIVE that the radio buttons i have on stage are in the same group. this is just weird to me.
ryoaska
05-12-2004, 06:39 PM
(i should note that i'm doing this in mx2004- although i don't think mx radios have the 'selected' property). I also want to note that this happens with other components too. If i initialize a listbox using "addItem" on the first frame- then jump to another frame and jump back- the listbox get's populated the first time, and never again after that.
interestingly- i try the same things as above in flash mx- and it DOES work for the radio buttons (using setState)- but i still get the same problem with components like listbox...what is up here???
Viath
05-12-2004, 06:42 PM
Here is a zipped .fla file to show you what I did, it's very basic, this works fine on my end, if you want, take a look and see if it works for you.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.