3 Replies Latest reply on Mar 21, 2010 6:01 PM by utsav_123

    Quiz applet help, probably quite simple but I'm a novice.

    utsav_123

      Hello all,

                     I'm having a little bit of trouble with a quiz applet that I am creating.

       

      The applet reads data from an XML file with 10 pre-determined questions and answers, all has worked well apart from the summary screen at the end, which is meant to show the number of correct answers, the number of incorrect answers and a score as a percentage.

       

      Below you can see the summary screen, which is meant to show 3 correct and 7 incorrect but as you can see, the results are completely skewed:

      summary.png

      The timeline is shown here, and the variable "numOfQuestionsAnsweredCorrectly" is where the number of correct answers are stored:

      timeline.png

      Below shows which box the variable is assigned to, so that the number of correct answers is shown:

      correctBox.png

       

      I would be very grateful if somebody could show me where I am going wrong as I have tried to change variable names and assign them to random test boxes, to no avail.

       

      Thanks in advance!

        • 1. Re: Quiz applet help, probably quite simple but I'm a novice.
          kglad Adobe Community Professional & MVP

          i can't tell where all your errors are but, it appears you may be treating the textfield variable and possibly data received from your xml as if they are numbers.

           

          flash treats the textfield variable and all xml data as strings.  so, you'll want to use the Number() function to cast that textfield variable (and anything from the xml that you want to use as a number), as a number.

          • 2. Re: Quiz applet help, probably quite simple but I'm a novice.
            utsav_123 Level 1

            I understand what you are saying but I'm not quite sure how to implement the Number () function into my existing coding.

             

            If it makes it any clearer, the number of answers correct and the number of answers incorrect seem to be actually linked to something and counting something because if I chose 'A' for all the answers which would always be 4 correct (6 incorrect), the results show 2 correct, 0 incorrect and score as 100. If I chose all 'B' then the results would always be 3 correct (7 incorrect) and the summary screen would show 1 correct, 0 incorrect and score as 100.

             

            All 'C' give a certain result, as does all 'D'. Would it be possible for me to upload my xml and .fla file somewhere so that you may be able to have a look for me as I cannot explain the layout of my Timeline and the coding within it.

             

            Thanks again for your prompt response, I was pleasantly surprised that someone would reply so quickly!

            • 3. Re: Quiz applet help, probably quite simple but I'm a novice.
              kglad Adobe Community Professional & MVP

              i don't download and correct files unless i'm hired.

               

              for free help you'll need to explain how you're calculating the score or wait for someone else to download your files.