Skip to main content
February 13, 2007
Question

Variable problems

  • February 13, 2007
  • 12 replies
  • 768 views
Hi, I am making a quiz in flash and the variables are loaded externally (through flash vars) that's not the problem as that part works properly, for each question there are 5 variables (loaded from the html doc) they consist of a question, three possible answers and the answer (stored as either 1,2 or 3)
So when someone clicks on a possible answer (three different buttons) the button executes a code (at bottom ):

the global.q1answeruser is the answer of the user (1,2 or three corresponding to the buttons which make the variable equal 1,2 or 3 then go to another frame where the above script is executed) then the frame goes to the correct screen or the incorrect screen etc. Problem is that any answer I click on it goes to the correct screen. Checked all the frames and stop(); stuff and all that. Need help.
I have tried using the == sign and all but does not work
links to the html doc with the variables and the fla. below (note my quiz cannot use javascript as This is for myspace):
fla
html doc
This topic has been closed for replies.

12 replies

February 16, 2007
No, flashvars is when you load variables from the html (so its like a <param"flashVars= blahblah") and the problem is when the flashvar equals one for instance and then I check it with a variable from the flash file the two don't match eg

if(flashvarsvariable == swfvariable){
}
But it would be false, idk why but maybe its some kind of encoding. And I do have the variables displayed for testing.
Inspiring
February 15, 2007
Ok, a litte more background....

You are using LoadVars just to pull the answer in right? If it were me, I'd do this...

On each quiz page, run a LoadVars and pull your data in. catch the onLoad event and store the loaded values into either an array or some other variable to be used by the app when the user hits next or whatever. For testing sake, you may also want to display the content of loadVars into the output panel using trace. When they hit next, test the answer given with the stored value. If they got it right (the two variables match), increment the number of correct answers they've gotten and redirect them to the correct screen. If they get it wrong, increment the number of wrong answers and redirect them to a wrong screen. Does this all make sense?
February 14, 2007
I've found out that it is the flashvars (when I plug the answer variable into flash without using flashvars it works, so I just use the flashvars for text not actionscript)

But why isnt the flash vars working, is it encoding? cause its not compatible to work with acrionscript !
February 14, 2007
ok but it says that there are not any. I tried the same thing with another flash file

if(var1 == var2){
gotoAndPlay(7);
}
and this worked but the one in the quiz does not; I even made the flashvars variable copy to a normal variable (although the flashvars variable should work) but nothing works, I have dynamic text boxes to display the numbers and for the right answer they each equal 1 but the if statement does not work, last resort, does anyone know how to do it differently?

Max
kglad
Community Expert
Community Expert
February 14, 2007
you can always use the flash test or the check syntax option in the actions panel to check for syntax errors.
February 14, 2007
I don't think I can because it uses flashvars (loaded from html doc) the flashvars work though because I made an input box to display the answer (1,2,3) on the same frame as the questions.
kglad
Community Expert
Community Expert
February 14, 2007
test your movie in the flash test environment (ctrl-enter is default key combo) and check the compiler errors.
February 13, 2007
still not working!
February 13, 2007
k will try
Inspiring
February 13, 2007
change your gotoAndplays to gotoAndPlay that appears to be the problem on my end