FORUMS: list search recent posts

How to make a button unclickable after it's been clicked

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Caitlin Conklin
How to make a button unclickable after it's been clicked
on Mar 14, 2013 at 4:11:29 pm

Hi,
I'm creating a jeopardy board game for my friend and everything's going great and I finished it, but I just wanted to know if there was a way where if a button was clicked, it could not be clicked again. This is the only thing I cannot figure out.
For instance, if they choose the category Pop Hits for 100, they answer the question then it goes back to the first frame but that button is no longer an option (it can't be clicked). I made each button so that the question and answer would appear on different frame numbers, so when they are on the first frame it has the numbers and categories, and then when they click the 100 button it jumps to frame 5, then the answer is on frame 6, then it goes back to frame 1.
Is this possible to make it unclickable once it's been clicked??
And the only coding I've used so far is just all
on(release) {
gotoAndPlay(5); }

Thanks,
Caitlin


Return to posts index

Sam Mattern
Re: How to make a button unclickable after it's been clicked
on Mar 15, 2013 at 12:56:26 pm

It's accomplished different ways depending on your exact setup. This should work, though:

on(release) {
this.enabled = false;
gotoAndPlay(5); }


-Sam


Return to posts index

Caitlin Conklin
Re: How to make a button unclickable after it's been clicked
on Mar 15, 2013 at 4:10:16 pm

Hey Sam,
I tried doing that but once it goes back to frame 1, that button is still clickable. Any other suggestions?


Return to posts index


Sam Mattern
Re: How to make a button unclickable after it's been clicked
on Mar 15, 2013 at 8:56:51 pm

You could create an array that stores the state of each button. Then on frame 1, run a loop that disables all of the ones that are supposed to be disabled.

You could have an array for each column, so column1_arr, column2_arr. Then column1_arr[0] would be column 1, "answer" 1, column2_arr[1] would be column1, "answer" 2.

Your loop would be
for ( var i=0; i<column1_arr.length; i++ ){
column1_ans1_btn.enabled = column1_arr[i];
}


Basically, to disable the button, you would set column1_arr[2] = false if you wanted to disable the third button in column1. You'd need to define all of your arrays like column1_arr = new Array(true,true,true,true,true); Something like that for 5 questions.

You could go one step further and do a matrix such that the first number is the column and the second number is the row (column_arr[1,2] for column1, "answer" 2).

Hope that helps!

-Sam


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]