A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Making button 'inactive' after selecting it

  1. #1
    Senior Member
    Join Date
    May 2000
    Posts
    200
    Hey guys,

    I originally posted this question in "General Help" a while back, but haven't gotten much response. http://board.flashkit.com/board/show...threadid=93856
    Figured I'd come to the actionscript people.

    Basically: I've got a Flash 5 game. It's an outline of a house. When the user answers a question correctly, he gets to select a part of the house to build. The game then loops back and imports another question.

    Problem is: When the user answers another question correctly, he gets to choose another portion of the house, but the one that was already chosen is still active.

    I've been trying all kinds of stuff. My latest trend, as suggested by BenchUK in the first posting is making a fake button in a movie clip. This works fine until the game loops back to the question frame.

    Can anyone help? Sorry for the long post, but I tried to explain it as best I could.

    Thanks!


  2. #2
    Senior Member
    Join Date
    Feb 2001
    Posts
    206
    It's a little confusing as to how the user selects a portion of the house. Do they click on it? Use a button? Perhaps when a portion of the house is clicked you set a variable box to a certain value. i.e. if chimney is selected, on press set variable a=1. Then at the next set of questions when the user has the choice to pick another portion of the house attach an if statement ( if variable a=1, then don't allow this to be clicked ). Not sure if this is clear but if you give a little more info on how the choices work maybe can give a little more input.

    Flashlite

  3. #3
    Member
    Join Date
    Oct 2000
    Posts
    78
    not sure how you have this setup, but try this.

    1. create a movie clip (we'll call it button1 for the sake of argument) with 2 frames, each with a stop action in it.

    2. in frame 1 place your "active" button in it. (don't forget you may have to change the targeting if this is not how you already have it setup).

    3. in frame 2, place an 50% alpha graphic of the button, or however you want to handle the "inactive" button.

    4. when the user clicks on the "active" button. have it set a global variable

    -----------------------------------------------
    on (release) {
    _root.hasButton1BeenPushed = "true";
    }
    -----------------------------------------------

    5. in your first frame of your main timeline have a simple "if" statement
    -----------------------------------------------
    if (hasButton1BeenPushed eq true) {
    _root.button1.gotoAndStop(2);
    } else {
    _root.button1.gotoAndStop(1);
    }
    -----------------------------------------------

    in this example, it is assumed that the movie clip with your "active" and "inactive" button has been placed on the main timeline with a instance name of button1.

    hope this helps.

  4. #4
    Senior Member
    Join Date
    May 2000
    Posts
    200
    AWESOME!

    flashlite and tapo -
    Thanks for your help guys! I've got it working now! I was trying to use variables before, but forgot the '_root' part, so I guess they were just local. (duh)

    I made some slight variations on tapo's code to make it work with my movie.

    Thanks so much for all your help!


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