Bonjour,
j'ai une partie de code d'un quizz en flash et y'a certains elements du code que je ne comprend pas bien. Ils sont mis en gras.
Le quizz est couplé a un xml.
_-__-___--__-_-_-_-_-_-__-_---___--__-_--__--_--_--__--__--_____----_
bouton1._visible = false;
quizz_xml = new XML();
quizz_xml.ignoreWhite = true;
quizz_xml.onLoad = function() {
xmlEnCours = quizz_xml.firstChild.firstChild;
afficheQuestion();
};
afficheQuestion = function () {
if (xmlEnCours==undefined) {
_root._visible = false;
} else {
enonce = xmlEnCours.firstChild.firstChild.nodeValue;
reponses = xmlEnCours.firstChild.nextSibling.childNodes;
) {
for (n=0; reponses.length>n; n++) {
duplicateMovieClip(bouton1, "bouton_"+n, n);
nouveauClip = _root["bouton_"+n];
nouveauClip._y += (nouveauClip._height)*n;
texte = reponses[n].firstChild.nodeValue;
bonne_reponse = reponses[n].attributes.bonne_reponse;
nouveauClip.bonne_reponse = bonne_reponse;
nouveauClip.onRelease = function() {
//trace("click");
if (this.bonne_reponse == 'true') {
//trace("OK");
afficheReponse.htmlText = "<font color='#006600'>Bien joué</font>";
} else {
afficheReponse.htmlText = "<font color='#cc0000'>Mal joué</font>";
}
xmlEnCours = xmlEnCours.nextSibling;
afficheQuestion();
};
nouveauClip.reponse = texte;
//trace("FIN");
}
}
};
quizz_xml.load("quizz_questions.xml");
//
_-__-___--__-_-_-_-_-_-__-_---___--__-_--__--_--_--__--__--_____----_
Voila donc les elements que je ne comprend pas sont:
- duplicateMovieClip(bouton1, "bouton_"+n, n);
Pourquoi la profondeur est n?
- nouveauClip._y += (nouveauClip._height)*n;
Que signifie le *n
- nouveauClip.reponse = texte;
Que signifie ce morceau de code.
Un grand grand merci d'avance.
Partager