To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 01-10-2007, 03:30 PM   #1
Kojak2
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.
Kojak2 is offline   Reply With Quote
Old 01-10-2007, 05:14 PM   #2
gparis
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)
gparis is offline   Reply With Quote
Old 01-10-2007, 05:23 PM   #3
Kojak2
Junior Member
 
Join Date: Feb 2003
Posts: 25
ok. how come?
Kojak2 is offline   Reply With Quote
Old 01-10-2007, 05:30 PM   #4
gparis
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)
gparis is offline   Reply With Quote
Old 01-10-2007, 05:35 PM   #5
Kojak2
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?
Kojak2 is offline   Reply With Quote
Old 01-10-2007, 07:28 PM   #6
gparis
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)
gparis is offline   Reply With Quote
Old 01-11-2007, 09:42 AM   #7
Kojak2
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.
Kojak2 is offline   Reply With Quote
Old 01-11-2007, 10:27 AM   #8
gparis
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)
gparis is offline   Reply With Quote
Old 01-11-2007, 10:33 AM   #9
Kojak2
Junior Member
 
Join Date: Feb 2003
Posts: 25
Ahhh...that's what I'm talking about. Thanks a ton! Sorry for the confusion.
Kojak2 is offline   Reply With Quote
Old 01-16-2007, 11:16 AM   #10
Kojak2
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!
Attached Files
File Type: fla Test.fla (32.0 KB, 24 views)
Kojak2 is offline   Reply With Quote
Old 01-16-2007, 11:23 AM   #11
gparis
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)
gparis is offline   Reply With Quote
Old 01-16-2007, 11:45 AM   #12
Kojak2
Junior Member
 
Join Date: Feb 2003
Posts: 25
Thanks! I changed that out but still nothing is happening when all the buttons are clicked.
Kojak2 is offline   Reply With Quote
Old 01-16-2007, 12:31 PM   #13
gparis
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)
gparis is offline   Reply With Quote
Old 01-16-2007, 12:53 PM   #14
Kojak2
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.
Kojak2 is offline   Reply With Quote
Old 01-16-2007, 02:15 PM   #15
gparis
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;
Now your buttons, i assume, are inside the MC Buttons, right?

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)
gparis is offline   Reply With Quote
Old 01-16-2007, 02:41 PM   #16
Kojak2
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.
Kojak2 is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:39 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.