4 Replies Latest reply on Aug 5, 2014 7:18 AM by Rezu

    Create very simple quiz function

    Rezu Level 1

      Greetings,

       

      I'm trying to create a very simple function that records clicks on 'correct answer' buttons, and when correct answers == 3, the user is taken to a label that has completion text on it. Nothing fancy, just clicking on text (or does it have to be text converted to symbol?), that increments a variable and when it ==3 it goes to a label on the timeline.

       

       

      Here's the code I have... but it doesn't seem to be working...

       

      i = 0;

      sym.$("ques1Yesbtn","ques2Yesbtn","ques3Yesbtn").click(function(){

                i++;

       

                if (i==1){

                          q1 = 1;

                }

       

                if (i==2){

                          q2 = 1;

                }

       

                if (i==3){

                          q3 = 1;

                }

       

                var gotoFinishedLabel = q1 + q2 + q3;

       

                if (i==3){

                         // play the timeline from the given position (ms or label)

                          sym.play("finished");

                          }

       

                 else {

                          // play the timeline from the given position (ms or label)

                          sym.play("quesHome");

                          }

      });

       

       

      Many Thanks for Any Help!

       

      AB