Hey everyone, I've been looking all over the forum but I can't find anything to help me understand what is happening with my file!!
I'm trying to create a simple quiz game,however the questions should be loaded from an external xml file. The thing is, while each question and each answer is correctly loaded the "if" condition doesn't seem to work!!
Let me explain a while..
Code:
catalogue.onLoad = function(success) {
if (success) {
// Load label/answer on button 1
b1.lb1 = this.firstChild.childNodes[_root.record].attributes.ans1;
// Load label/answer on button 2
b2.lb2 = this.firstChild.childNodes[_root.record].attributes.ans2;
// Load variable of correct answer to check
check1 = this.firstChild.childNodes[_root.record].attributes.var1;
// Load variable of wrong answer to check
check2 = this.firstChild.childNodes[_root.record].attributes.var2;
record++
}
}
So far all good, my program loads the variables correctly. However I'm trying to find a way to see which of these buttons was pressed (and I can't find any way to do it..

)
So since i'm guessing that value "check1" is associated with button1,I'm trying to use an "if" statement to test the value of this variable. However, my if statement doesn't go beyond checking value "check1"..
Code:
onFrame (51) {
if (check1==1 && check2==0) {
gotoSceneAndPlay("Scene_4", 1 ); //correct answer
}
else
{
gotoSceneAndPlay("Scene_5", 1)}; // wrong answer
}
Is this the correct way to do it or is there a way for me to check which button was pressed according to a variable assigned to the external xml file so that if I want to change the game's contents I'll only edit the xml file?
Hope that wasn't confusing..sorry for the long post,I'm really new to SwishMax and I'm going crazy with this problem..