9 Replies Latest reply on Feb 12, 2010 8:10 AM by Ned Murphy

    Help with an interactive Quiz

    hezy87

      Hi all

       

      For my project i am creating a quiz on the Romans. There are only three questions that the user must answer with three possible answers in frames 3,4 and 5 (one question per frame).

       

      I want to know the code that would help me to allow a Jpeg (an evaluation of the answer given on each frame) to be placed on frame 6 ready for the user to receive feedback for each answer they have given. So when the user selects an answer, the corresponding jpeg to that answer is placed ready on frame 6 for their arrival after they have answered all three questions

       

      Hope this makes sense and i would be very grateful for any advice.

       

      cheers Hezy87

        • 1. Re: Help with an interactive Quiz
          Ned Murphy Adobe Community Professional & MVP

          You cannot control content in a frame unless you are there.  But one approach could be to have whatever frame 6 will be as a movieclip that is kept invisible from frames 1 thru 5, wherein you can add whatever image however you plan to do that in those frames, and when you get to frame 6 you set that movieclip to be visible.

           

          Another approach would be to have variables that you store the answer information into and make use of in frame 6 to decide which image(s) to display.

           

          There are probably several ways to approach it, but the bottom line is, unless you're in frame 6, you cannot add new content into it.

          1 person found this helpful
          • 2. Re: Help with an interactive Quiz
            hezy87 Level 1

            thanks Ned

             

            i will firstly try setting the movie clip to be visible = False once the application opens and experiment this way first

            • 3. Re: Help with an interactive Quiz
              Ned Murphy Adobe Community Professional & MVP

              You're welcome

              • 4. Re: Help with an interactive Quiz
                hezy87 Level 1

                hi again

                 

                Im having a few problems, Firstly i intend to attempt to use variables to set a specific score to a variable when a specific answer is clicked on. for this i have attempted to identify the variables in a layer called 'actions'. in frame 1(should this be done in every frame? or would that reset the 'true' answers given?) of the 'actions' layer i have used the code:

                 

                 

                stop ();

                 

                var answerA:Boolean;

                answerA = false;

                var answerB:Boolean;

                answerB = false;

                var answerC:Boolean;

                answerC = false;

                 

                 

                .........this goes up to answerI.

                 

                on the next frame the first question will appear with 3 jpegs converted to buttons, which are the three possible answers. when one button(named button"letter of Answer" is clicked onto i want the application to move onto the next frame and change the appropriate variable to be set at true from then on.

                 

                i assumed that the following would do this(if the button representing answer B was clicked)

                 

                on(Release) {

                goToFrame(3);

                answerB = true;}

                 

                the same process would be used for frame 3 with answers D,E,F for question 2, and frame 4 with answers G,H,I. The on frame 5 all 9 of the jpg's which evaluated the possible answers for each question are set to visible = false(they are converted to movie clips called answerAevaluate ect...). i have tried using an "evaluate" button that looks to see which answers are true and then sets the corresponding evaluation to visible = true. however this does not work.

                 

                hope this makes sense

                any help would be much appreciated

                • 5. Re: Help with an interactive Quiz
                  Ned Murphy Adobe Community Professional & MVP

                  I got a bit lost when it came to trying to understand what you're doing with the evaluation ends of thing.  What logic is used to control things in what way?To simplify it, try describing it as if there were just one question in the whole thing.

                  • 6. Re: Help with an interactive Quiz
                    hezy87 Level 1

                    ok if there was one question there would be two frames, one for the question and one for evaluation

                     

                    in frame 1 there is an actions layer where the code is put to firstly stop the application on this frame and then to name three varibles which will correspond to the three possible answer which are all also buttons. there is also a layer for each button labelled A,B and C and each button should link to the next frame with additional code to set a varible that can be looked at by the next frame.

                     

                    on the second layer all of the evaluation panels(jpgs converted to movieclips) are on seperate layers and are hidden using the code visible = false coding. i want either a button or some other function to look at what option was selected in frame1 and then display the corrosponding panel by using the code visible = true.

                     

                    i have been researching the Boolean actionscript as this uses simply true or false which i was attempting to apply to the answer choices so that the one selected would change to true. then i was hopin an "if" and "else if" statement would check to see which buttons/answers had been selected and display the correpsonding answers by making them visible.

                     

                    i can try to attach a simple file showing how far i have got if this would help.

                     

                    Again i much appreciate any adivce and help

                     

                    i have now attached a simple version with the code i have been trying to use

                    • 7. Re: Help with an interactive Quiz
                      Ned Murphy Adobe Community Professional & MVP

                      The only problem I see with what you've done is you use =  where you should use ==.

                       

                      = is to assign a value to something

                       

                      == is for comparing things for equality

                       

                      Also, if you are testing a boolean variable, you don't even need to use the == , using the variable by itself is sufficient because the conditional is evaluating whether what's in it is true or false...

                       

                      if(answer_B){

                           etc....

                      }

                      1 person found this helpful
                      • 8. Re: Help with an interactive Quiz
                        hezy87 Level 1

                        Cheers Ned

                         

                        i have tinkered with the "==" and removed the:

                         

                        var answerA:Boolean;

                        answerA = false;

                         

                        var answerB:Boolean;

                        answerB = false;

                         

                        var answerC:Boolean;

                        answerC = false;

                         

                        from the seoncd frame of the actions layer, this seems to have worked. I will now attempt to apply this to three questions.

                         

                        Thanks for all you time and help, I hope you dont mind if i return with anymore problems

                         

                        thanks again

                         

                        hezy87

                        • 9. Re: Help with an interactive Quiz
                          Ned Murphy Adobe Community Professional & MVP

                          You're welcome.  It'll be best to start a new posting if you return.  Postings with discussions piled up can be easily overlooked.