469,276 Members | 1,687 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,276 developers. It's quick & easy.

Only one Answer

Im pretty new to Flash And Ive gotton stuck on a quiz - so looking for help!!!

Ive got a quiz with 10 questions and each with a true or false MC next to them to be selected. At the end a check answer button calculates if the correct answers have been selected:

on (release) {
finalresult = result;
result += 0;
first1 = 1;
first2 = 1;
first3 = 1;
first4 = 1;
first5 = 1;
first6 = 1;
first7 = 1;
first8 = 1;
first9 = 1;
first10 = 1;
stop();
if (finalresult<6) {
comment6.text = "You only got "+finalresult+" correct.";
}else if ((finalresult>5) && (finalresult<11)){
comment6.text = "Well done you got "+finalresult+" correct.";
}else if (finalresult>10){
comment6.text = "To many hits, press the reset button!!";
}


BUT, What Im looking for; is there any way that some actionscript can be put on the true and false mc's so that once they have been hit once they cannot be counted again if the user accidentily hits the button again or changes there mind then hits back onto it?

Hope this makes sense - all advice would be REALLY appreciated!
Nov 19 '07 #1
3 1484
rsdev
149 100+
Im pretty new to Flash And Ive gotton stuck on a quiz - so looking for help!!!

Ive got a quiz with 10 questions and each with a true or false MC next to them to be selected. At the end a check answer button calculates if the correct answers have been selected:

on (release) {
finalresult = result;
result += 0;
first1 = 1;
first2 = 1;
first3 = 1;
first4 = 1;
first5 = 1;
first6 = 1;
first7 = 1;
first8 = 1;
first9 = 1;
first10 = 1;
stop();
if (finalresult<6) {
comment6.text = "You only got "+finalresult+" correct.";
}else if ((finalresult>5) && (finalresult<11)){
comment6.text = "Well done you got "+finalresult+" correct.";
}else if (finalresult>10){
comment6.text = "To many hits, press the reset button!!";
}


BUT, What Im looking for; is there any way that some actionscript can be put on the true and false mc's so that once they have been hit once they cannot be counted again if the user accidentily hits the button again or changes there mind then hits back onto it?

Hope this makes sense - all advice would be REALLY appreciated!
Attach a click counter to each mc.

Expand|Select|Wrap|Line Numbers
  1. on (release){
  2.  
  3. if(this.clicked==0){
  4. _root.first1 = true; // or button_name.first1 = true
  5. this.clicked++;
  6. }
  7. }
But I'm not sure how your finalresult and result variables work?! You keep adding 0 to the result (0+0=0)... Unless you mean the result is false?

I don't really understand!!

Read up in flash help about functions and your code would be neater by creating an onRelease function then you don't have to copy the code for each button.
Nov 19 '07 #2
Thanks Ill give that a go and see how I get on - Really appreciate it! Thanks again!!!
Nov 21 '07 #3
rsdev
149 100+
Hope it helps!!!

Let me know.
Nov 21 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Arne Kösling | last post: by
3 posts views Thread by George Sakkis | last post: by
4 posts views Thread by Bloon | last post: by
4 posts views Thread by Mrozu | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.