3 Replies Latest reply on Jul 19, 2008 11:45 AM by amanojorge

    Global variables values change spontaneously

    amanojorge
      I am currently making a quiz/board game. There is a "Take question card" button which goes to a random frame in a specified movie. Every frame in that movie has a question with answers that make the players advence on the board. The problem is, I need to make sure that once a question has appeared and been answered, it can't pop up again. I thought about declaring a global variable for each question ("_global.q1" for question 1, and so forth) in frame one of the root movie with a value of "0". The answers to each question will then, additionally to moving the pieces on the board, change the variable's value to "1" (on(release){_global.q1 = "1"}). And, directly in each question's frame of the question container movie, I made an invisible movie with the script below, thinking that the first time that frame loads the variable must be set to 0, so the question will load normally; and afterwards, since the answer set the value to 1, the script below will go to the next frame. Thus, no question is repeated.

      onClipEvent (enterFrame) {
      if (_global.q1 = "1") {this._parent.nextFrame()};
      }

      However, on testing the movie, I press the button with the gotoAndPlay(random()) and all my variables values set to one, taking me all the way to the last frame in the question containing movie.