A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Quick Question

  1. #1
    I am making a Jepordy type game and I need it so when the user click on a question box then they can not click on it again later in the game so I was woundering if there is some sort of code to deactivate the button?


    Thanks

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Posts
    314
    I'd do something like this:

    Setup:

    Code:
    square = new Array();
    for (x = 1; x <= 6; x ++) {
        square[x] = new Array();
        for (y = 1; y <= 5; ) {
            square[x][y] = true;
        }
    }
    In the button:

    Code:
    on (release) {
        if (_root.square[1][1] == true) {
            _root.square[1][1] = false;
            // Ask the question
        }
    }

    Put the setup code on the main timeline near the begining of the movie (wherever you do your other setup stuff). It sets up a 2d array that is 6 wide by 5 tall (the size of a Jeopardy board). And it assigns "true" to each index in the array. (We're using "true" here to mean that the square has not been selected).

    The button code checks the array to see if the corresponding index still contains "true", meaning that it hasn't been selected. If it is "true", it changes it to "false" and asks the question. (Of course you'll change to the [1][1] to the appropriate numbers for each square, and you'll replace "// Ask the question" with whatever code you're using to ask the question).

    Hope that helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center