[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