PDA

View Full Version : [ACTIONSCRIPT]: quick question



[Oli]
07-10-2007, 08:36 PM
i have this sort of quiz thing with multiple choise.

when you click one of the 3 choices i have a code:

resultaat1 = "juist";

meaning result = "correct"; but in dutch.

now to do something later on with it, i need to check the awsners of all my questions so i have this on the top frame:


function bereken(){
if(resultaat1 == "juist" && resultaat2 == "juist"){
do something
}
}


is this correct ? should i use && or || ?

anyway all i know is, it's not working for me :p

Net-Margin
07-10-2007, 09:27 PM
Ok I have never worked with Actionscript, but I have worked with a few other languages so just a few questions. Have you defined resultaat2? because if you haven't that could be why it's not working. I'm not sure of the operators in Actionscript. You could perhaps also try


function bereken(){
if(resultaat1 == "juist"){
do something
if(resultaat2 == "juist") {
do something
}
}
}

I have no idea if you can incase another IF statement into another one, but you can in VB which is one of the languages I use a lot.

If not just try messing around with the && or == operators or something, because I have no idea about AS. You may have to mess around with else statements if AS use them as well, but I don't know.

[Oli]
07-10-2007, 09:54 PM
Thanks for helping but that wont work.

As I need all awnsers to be correct at the same time.
I have 10 questions so its like;


function bereken(){
if(vraag1 == "juist" && vraag2 == "juist" && vraag3 == "juist" && vraag4 == "juist" && vraag5 == "juist" && vraag6 == "juist" && vraag7 == "juist" && vraag8 == "juist" && vraag9 == "juist" && vraag10 == "juist"){
punten = 10;

}else if(vraag1 == "juist" && vraag2 == "juist" && vraag3 == "juist" && vraag4 == "juist" && vraag5 == "juist" && vraag6 == "juist" && vraag7 == "juist" && vraag8 == "juist" && vraag9 == "juist" && vraag10 == "fout"){
punten = 9;

& this goes on untill they all say "fout" meaning "incorrect"
& punten = 9; means graids = 9;

so i have a dynamic text field with varname: punten & nexto it a static text field saying /10

so if one would be "fout" / "incorrect" it should state 9/10 get me ?

Want to hide these adverts? Register an account for free!