|
|
|
#1 |
|
Junior Member
Join Date: Feb 2003
Posts: 25
|
Bingo Game Script
Hello,
I am horrible at actionscript and I hope some one can point me in the right direction. I basically have a Bingo card with the numbers called already. If the user clicks (marks) the right winning numbers the user wins. How can I program it to see if all the winning numbers have been clicked? **This is for Flash 6. Thanks ahead. |
|
|
|
|
|
#2 |
|
Super Moderator
Join Date: Aug 2000
Location: Montréal
Posts: 13,430
|
i usually redirect this type of threads to the Movie section here on Flashkit
gparis
__________________
![]() AS 2.0 Forum Guidelines || Use P H P tags for code samples || Flash LiveDocs || AS 2.0 Language reference (CS4) |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Feb 2003
Posts: 25
|
ok. how come?
|
|
|
|
|
|
#4 |
|
Super Moderator
Join Date: Aug 2000
Location: Montréal
Posts: 13,430
|
http://board.flashkit.com/board/showthread.php?t=584396
if you have a specific question on a script, post the script. gparis
__________________
![]() AS 2.0 Forum Guidelines || Use P H P tags for code samples || Flash LiveDocs || AS 2.0 Language reference (CS4) |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Feb 2003
Posts: 25
|
Thanks gparis but I'm new to AS so I was looking for a little help as to where to start. Is it an if/then?
|
|
|
|
|
|
#6 |
|
Super Moderator
Join Date: Aug 2000
Location: Montréal
Posts: 13,430
|
depends on how you are set so far. Could be an if/else if. Could be an Array, could be a switch(case) could be a for loop, while loop etc. if you have a script post it, if not post a mockup .fla.
And this search in the Movies section yielded 3 results: http://www.flashkit.com/search.php?c...&Submit=Search gparis
__________________
![]() AS 2.0 Forum Guidelines || Use P H P tags for code samples || Flash LiveDocs || AS 2.0 Language reference (CS4) |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Feb 2003
Posts: 25
|
Thanks. I saw those Bingo files too. Guess I thought it would be simpler than that. I'm really just trying to find out whether four buttons have been clicked or not. I don't need to generate numbers or fill the grid or anything like that.
Basically have four buttons and I'm trying to find out if they all have been clicked. The file is 500k - too big to post. |
|
|
|
|
|
#8 |
|
Super Moderator
Join Date: Aug 2000
Location: Montréal
Posts: 13,430
|
You set variables. set them all to false. Then when you click, set them to true. The validation part would be to verify if they are all true.
gparis
__________________
![]() AS 2.0 Forum Guidelines || Use P H P tags for code samples || Flash LiveDocs || AS 2.0 Language reference (CS4) |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Feb 2003
Posts: 25
|
Ahhh...that's what I'm talking about. Thanks a ton! Sorry for the confusion.
|
|
|
|
|
|
#10 |
|
Junior Member
Join Date: Feb 2003
Posts: 25
|
Ok. I'm back with some code. I've read up on a few things and thought this would work but it's still isn't for some reason.
On the first frame I'm declaring four variables (my buttons) set to false. Each button has an action setting it to true. Then my checker on the first frame of my mc: Buttons.onEnterFrame = function() { if (button01==true, button02==true, button03==true, button04==true) { _root.gotoAndPlay(5); } }; Here is my test .fla. This is for Flash 6. Any ideas? Thanks! |
|
|
|
|
|
#11 |
|
Super Moderator
Join Date: Aug 2000
Location: Montréal
Posts: 13,430
|
if (button01 && button02 && button03 && button04)
would be the right syntax. saying if(button1) is equivalent to if(button1==true) && means 'and' that way makes a less long statement. gparis
__________________
![]() AS 2.0 Forum Guidelines || Use P H P tags for code samples || Flash LiveDocs || AS 2.0 Language reference (CS4) |
|
|
|
|
|
#12 |
|
Junior Member
Join Date: Feb 2003
Posts: 25
|
Thanks! I changed that out but still nothing is happening when all the buttons are clicked.
|
|
|
|
|
|
#13 |
|
Super Moderator
Join Date: Aug 2000
Location: Montréal
Posts: 13,430
|
root.gotoAndPlay(5) will not in the enterframe (as the playhead will keep on going to that frame and never pass it)
You'll need to delete the enterFrame first: Buttons.onEnterFrame = function() { if (button01 && button02 && button03 && button04) { delete Buttons.onEnterFrame; _root.gotoAndPlay(5); } }; gparis
__________________
![]() AS 2.0 Forum Guidelines || Use P H P tags for code samples || Flash LiveDocs || AS 2.0 Language reference (CS4) |
|
|
|
|
|
#14 |
|
Junior Member
Join Date: Feb 2003
Posts: 25
|
Right now the mc that has the buttons and this script is running on Frame 4 of the main timeline. When all the buttons have been clicked I want it to go to Frame 5 or the next frame in the main timeline.
Buttons.onEnterFrame = function() { if (button01 && button02 && button03 && button04) { delete Buttons.onEnterFrame; _root.gotoAndPlay(5); } }; does this delete my mc? I put it in the 1st frame of the mc but it's still not advancing. |
|
|
|
|
|
#15 |
|
Super Moderator
Join Date: Aug 2000
Location: Montréal
Posts: 13,430
|
1 ) careful with scopes:
that script above, as is, is supposed to go on the main timeline. (you're talking to Buttons, which i guess is sitting on the main timeline) 2) the references to the variables buttons, as is, means that these 4 vars are declared ON the main timeline as well. meaning, you declare them all to false: Code:
button01 = button02 = button03 = button04 = false; So their action should be: _root.button01 = true; //same for all 4 buttons: _root.button02 = true; ...etc. 3) careful with gotoAndPlay(x) : you can't tell the player head to gotoAndPlay() on a frame that has a stop() action on it. You need to decide if it plays or stops.... right? gparis
__________________
![]() AS 2.0 Forum Guidelines || Use P H P tags for code samples || Flash LiveDocs || AS 2.0 Language reference (CS4) |
|
|
|
|
|
#16 |
|
Junior Member
Join Date: Feb 2003
Posts: 25
|
That was it!
I had button01=true for an action instead of _root.button01-true I didn't realize variables were timeline sensitive. Is there a way to use variables globally? Thanks gparis. Last edited by Kojak2; 01-16-2007 at 02:45 PM. |
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|