1 Reply Latest reply on Sep 2, 2008 12:06 PM by Kol-001

    after 6 buttons are pressed jump to a new frame

    foowoo
      I have made a spot the differece game as you may have seen in another post. I have all the invisble buttons on one frame. When the button is pressed it reveals a correct answer, that button also then becomes inactive so you can not turn the answer off.

      I have 6 buttons in total btn1 - btn6

      How do I write the code so that after all the buttons have been pressed it jumps to a finsihing frame.

      I am also working flash 7 mx2004

      someone suggested the below but I'm sure how it works

      Create a root variable, _root.buttons_pressed = 0;
      Then, in each button onDown actionscript, _root.buttons_pressed++;
      Finally, you'll want to reset the counter when you enter the new frame,
      again setting _root.buttons_pressed = 0;

      Thanks in advance.

      Foo Text
        • 1. Re: after 6 buttons are pressed jump to a new frame
          Kol-001
          Hi foowoo,

          I may be wrong but aren't variables accessible throughout a timeline?

          If so then my suggestion would be to set up a variable in the first frame and, like suggested, have it increment with each button pressed (that is then disabled so it doesn't count up again) in the frame where the game is. If my theory is right then there's no need to reference _root. as it is all in the same timeline, just call the variable something like gameCounter and use that.

          Then I'd have a If gameCounter == 6 function which then does the resetting of the variable to 0 and sends the user to the finishing frame.

          Cheers

          kol