This content has been marked as final. Show 4 replies
anybody? the only other way i can think of doing this is by having a script on each scene so radio buttons will be q1A - q1D and do that for each question.
There are many ways to do this - one way or the other you need to group the buttons
1) Based on your example you could simply use the member names for grouping - instead of just comparing the name of the clicked member, compare whether or not char of the name is the same as the clicked member. If so, deselect.
2) You have the me parameter in your code, which suggests you are writing a behaviour which is attached to each radio on the stage. You could use sendAllSprites from the clicked member to tell other members to deselect. This way it will only affect any other radios on stage at the time and you don't need to hard code. Something like (pseudo-code)
on mouseUp me
clickedName = sprite(me.spriteNum).member.name
sendAllSprites(#radioclicked, me, clickedName )
on radioclickedme, clickedName
if sprite(me.spriteNum).member.name = clickedName then
sprite(me.spriteNum).member.hilite = 1
sprite(me.spriteNum).member.hilite = 0
I just realised you don't need the me parameter in sendAllSprites
sendAllSprites(#radioclicked, clickedName )
There is a behavior named "Radio Button Group" in the Controls pane of the Library Palette. Here is an extract of its description:
Select a group of radio button sprites and drop this behavior onto one of them. You will be asked to give a unique ID to the group so that its members can recognise each other.
When the movie is running, switching one button in the group ON will switch all the others OFF. By default, the button in the lowest sprite channel will be ON...
If you want to use your own graphics for the radio buttons, then you could try the behavior which you can find at http://nonlinear.openspark.com/tips/scripts/button/