Probleme Random

Freddu Messages postés 5 Date d'inscription samedi 20 novembre 2004 Statut Membre Dernière intervention 21 avril 2009 - 3 nov. 2006 à 23:44
Freddu Messages postés 5 Date d'inscription samedi 20 novembre 2004 Statut Membre Dernière intervention 21 avril 2009 - 4 nov. 2006 à 11:41
Bonjour tout le monde,

Voilà, j'ai 10 champs texte sur ma scène qui effectuent un (Math.Random) pour afficher des "0" Aleatoirement dans ces champs.

Mais je voudrais qu'il ne garde que 4 "0" Aleatoirement parmis ces 10 champs

Je vous mets le Script pour mieux comprendre.

bannerButton.onRelease = function() {
chiffre = ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0"];
for (i=1; i<chiffre.length; i++) {
_root["ab"+i] = chiffre[i];
for (j=1; j<4; j++) {
chiffre[i] = Math.round(Math.random()*4);
if (chiffre[i] == 0) {
_root["ab"+i] = " ";
}
}
}

Merci d'avance.

1 réponse

Freddu Messages postés 5 Date d'inscription samedi 20 novembre 2004 Statut Membre Dernière intervention 21 avril 2009
4 nov. 2006 à 11:41
Personne pour m'aider?
0
Rejoignez-nous