# Problem with counting game

Printable View

• 03-22-2004, 08:17 PM
Xander99
[HELP] Problem with counting game
hey guys, I'm working on this counting game for little kids but I have a problem. The function I have works fine the first time its called and shows the right number of tp's but when it's called again it gives almost a random number. Here's the link http://www.geocities.com/xanderjz99/newed-cd.swf

This is my function:

function settp() {
_root.vartpon=0
i = 0;
while (i<=9) {
_root[vartp+i] = int(random(2));
if (_root[vartp+i] == 0) {
_root["tp"+(i)].gotoAndPlay("yes");
_root.vartpon =_root.vartpon+ 1;
}
if (_root[vartp+i] == 1) {
_root["tp"+(i)].gotoAndPlay("no");
}

i++;
}
}

Hope someone can help
• 03-22-2004, 10:04 PM
St. Nick
The link doesn't work, I don't think geocities lets you link swf files maybe? Anyways, try linking an html page with the swf embeded on it. That should work.
• 03-22-2004, 10:53 PM
Xander99
always forgetting that grr adds to my great day lol k here's the link and the fla
http://www.geocities.com/xanderjz99/newed-cd.html
http://www.geocities.com/xanderjz99/newed-cd.fla

hope some1 can help , probably just one stupid problem
• 03-22-2004, 11:28 PM
Magnetos_II
dont know if this helps but here you go
it quite simple really :)

its MX format
• 03-22-2004, 11:44 PM
Xander99
thx that will help a lot it probably has 2 do with me using a while loop instead of a for
• 03-23-2004, 10:49 AM
Magnetos_II
Quote:

Originally posted by Xander99
thx that will help a lot it probably has 2 do with me using a while loop instead of a for
there isnt much difference between a for loop and a while loop
at least none that would make any difference for the game you are doing

both loops work fine