Checkbox answer needs to trigger visibility of movie clip
Hi, I am using AS2 and I am trying to create a script for a flag based guessing game. The situation is this:
I have the Spanish flag with 4 multiple choice options of: Spain, Norway, Macedonia and Italy. These are all checkboxes. Ofcourse the answer is Spain and so when Spain is checked and a "Submit" button is pressed. I want This to trigger the visibility of one of the tick/crosses. The tick/crosses are movie clips with translucent white shapes over them that are also set as movie clips. Basically, either "mcCoverYes" (the cover for the tick) or "mcCoverNo" (the cover for the cross) will disappear depdning on whether the user gets the right answer.
I am pretty new to Flash and everything I have attempted isn't working. I tried this action script on the button but it didn't work:
Code:
on (release) {
}
if (cbSpain == true) {}
{Yes_cover_mc._visible = false;
}else{
No_cover_mc._visible = false;
}
cbSpain is the checkbox labelled spain. Basically I am trying to say that when the button is released, if Spain is selected then the visibility of the "tick" graphic will disappear so that the tick appears in it's full colour. If cbSpain isn't selected, then the cover of the cross will be hidden to declare it as a wrong answer.
Thanks!
1 Attachment(s)
Adding Checkmarks between Senes AS2
Quote:
Sorry to keep asking questions but is there a way to affect another scene if the user were to correctly get the answer (Spain) so that when they go back to the previous scene (a scene with multiple flag choices to guess), the Spain flag has a tick over? Or is this too complicated?
Nothing is too complicated if you are willing to learn.
1) Create all of the checkmarks on top of your flags so they are ready to be used with actionscript. This means you create one check mark and make it a MovieClip. Then use that same checkmark for all flags, but give each a unique instance name example: checkMark1 or checkMarkSpain.
When you test the movie, all the check marks will be visible.
2) In the code you turn off the visibility of all the check marks:
checkMark1._visible=false;
checkMark2._visible=false;
checkMark3._visible=false;
checkMark4._visible=false;
When you test the movie now, the checkmarks should all NOT be visible.
3) Create variables so that you can know if the checkmarks are visible. In this example I will pretend '0' means not visible and '1' means visible When cm1visible=1 then we change the visibility of the checkmark;
4)When the user gets the question correct, then you would change the variable to a new value:
btnSubmit.onPress = function()
{
if (radioButtonPressed == 1)
{
Yes_cover_mc._visible = false;
mySound.start();
cm1visible=1;
}
5) then you would have a conditional statement in actions window that turns on the visibility of checkmark "on" based on the variable being changed or not.
if (_root.cm1visible == 1){ _root.cm1._alpha = 100;}
if (_root.cm2visible == 1){ _root.cm2._alpha = 100;}
if (_root.cm3visible == 1){ _root.cm3._alpha = 100;}