12 Replies Latest reply on Feb 16, 2007 2:37 PM by maxtkacz

    Variable problems

    maxtkacz
      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
        • 1. Re: Variable problems
          kglad Adobe Community Professional & MVP
          you have code that won't even compile. your fla opens on frame 3 of the _root timeline with code that isn't correct flash syntax fails a syntax check.

          in addition it contains two gotoAndplay() statements both of which are incorrect because case counts in flash and gotoAndplay() is not the same as gotoAndPlay().

          correct the basic problems in your code and retest.
          • 2. Re: Variable problems
            maxtkacz Level 1
            "you have code that won't even compile. your fla opens on frame 3 of the _root timeline with code that isn't correct flash syntax fails a syntax check.
            "
            Okay but what does that mean please help?
            • 3. Re: Variable problems
              SymTsb Level 2
              change your gotoAndplays to gotoAndPlay that appears to be the problem on my end
              • 4. Re: Variable problems
                maxtkacz Level 1
                k will try
                • 5. Re: Variable problems
                  maxtkacz Level 1
                  still not working!
                  • 6. Re: Variable problems
                    kglad Adobe Community Professional & MVP
                    test your movie in the flash test environment (ctrl-enter is default key combo) and check the compiler errors.
                    • 7. Re: Variable problems
                      maxtkacz Level 1
                      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.
                      • 8. Re: Variable problems
                        kglad Adobe Community Professional & MVP
                        you can always use the flash test or the check syntax option in the actions panel to check for syntax errors.
                        • 9. Re: Variable problems
                          maxtkacz Level 1
                          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
                          • 10. Re: Variable problems
                            maxtkacz Level 1
                            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 !
                            • 11. Re: Variable problems
                              SymTsb Level 2
                              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?
                              • 12. Re: Variable problems
                                maxtkacz Level 1
                                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.