rendered paste bodyvar win:Boolean = false;
//==============================
//parenkam klausimus zaidimui
var question:Array = new Array(questionsMin);
function testRand(num:Number):Boolean {
for (var i = 0; i<num; i++) {
if (question[i] == question[num]) {
return false;
}
}
return true;
}
for (var i = 0; i<questionsMin; i++) {
question[i] = random(questionsCount);
while (!testRand(i)) {
question[i]++;
if (question[i]>=questionsCount) {
question[i] = 0;
}
}
}
//==============================
var currentQuestion:Number = -1;
var correctAnswer:Number;
nextQuestion();
//==============================
//sekantis klausimas
function nextQuestion() {
currentQuestion++;
if (currentQuestion<questionsMin) {
questionText = questions_xml.firstChild.childNodes[question[currentQuestion]].childNodes[0].firstChild.nodeValue;
var correctAnswerID:Number = questions_xml.firstChild.childNodes[question[currentQuestion]].childNodes[1].firstChild.nodeValue;
correctAnswer = random(3)+1;
_root["answer"+correctAnswer+"_mc"].answer = questions_xml.firstChild.childNodes[question[currentQuestion]].childNodes[correctAnswerID].firstChild.nodeValue;
cia dirbu dbr...
} else {
clearInterval(startCountDown);
gotoAndStop("end");
}
}
//==============================
function pressed(num:Number) {
nextQuestion();
}
//==============================
answer1_mc.onRelease = function() {
pressed(1);
};
answer2_mc.onRelease = function() {
pressed(2);
};
answer3_mc.onRelease = function() {
pressed(3);
};
//==============================
//laiko limitas
var timeLeft:Number = 10;
startCountDown = setInterval(function () {
if (--timeLeft<=0) {
clearInterval(startCountDown);
gotoAndStop("end");
}
}, 1000);
//==============================