3 Replies Latest reply on Feb 9, 2011 6:32 AM by kglad

    How do I make a counter

    sevenaaaaaaa

      I want to create a counter at the end of my quiz

       

      after each question iclick the next button to go onto the next question

       

      how do i link each next question button to add 1 to the counter

       

      then once I've gotten to the counter page, how do I reset the counter back to 0

       

      thanks for any help you can give me

        • 1. Re: How do I make a counter
          kglad Adobe Community Professional & MVP

          use a variable to store the value for your counter.  update that variable whenever a next button is clicked:

           

          //initialize your counter variable

          var counterVar:Number=0;

           

          //whenever a next button is clicked, update counterVar:

          counterVar++;

           

          //to reset counterVar:

          counterVar=0;

          1 person found this helpful
          • 2. Re: How do I make a counter
            sevenaaaaaaa Level 1

            Where do i put the actionscript?

             

            i tried to put the actionscipt into the buttons that made sense to the naming tou gave me

             

            but each time, it comes up with an error message

             

            the actionscript already in the next topic button to reset the counter is:

             

            1     on (release) {

            2          gotoAndStop ("scene 2", 1)

            3     }

             

            how do i add the new actionscript without the error?

            • 3. Re: How do I make a counter
              kglad Adobe Community Professional & MVP

              attached to the frame that contains your first next button:

               

              var counterVar:Number=0;

               

              ////////////

               

              :

               

              1     on (release) {

              _root.counterVar++;

              2          gotoAndStop ("scene 2", 1)

              3     }