Hi…there…
I just made a fill in blank quiz which is work ok…my problem is how to set that user can only make only 2 attemption only…after “attempt=2” the check button will be disabled…and the wrong answer will be replace with correct answer in red color also…
this is the code I’m using…
stop();
var attempt = 0;
disabler.enabled = false;
disabler._visible = false;
var stageW = 400;
var stageH = 300;
////////////////////////////////////
function showWindow(linkageName){
disabler._visible = true;
var win = _root.attachMovie(linkageName, linkageName, 9999);
win._x = (stageW/2)-(win._width/2);
win._y = (stageH/2)-(win._height/2);
win.okBtn.onPress = function(){
win.removeMovieClip();
disabler._visible = false;
}
return win;
}
//
///////////////////////////////////
_correctansw = ["zero","one","two"];
_inputxt = ["input0","input1","input2"];
function checkansw() {
var field;
var numOfAns = _correctansw.length;
var numOfCorrect = new Array();
for (var i = 0; i < numOfAns; i++) {
field = _root["input" + i];
if (_correctansw* == field.text.toLowerCase()) {
numOfCorrect* = true;
} else {
numOfCorrect* = false;
}
}
//trace(numOfCorrect);
for (var i = 0; i < numOfAns; i++) {
field = _root["input" + i];
if (numOfCorrect*) {
field.html = true;
field.htmlText = "<font color='#CCFF00'>"+_correctansw*+"</font>";
} else {
field.html = true;
field.htmlText = "<font color='#FF0000'><b>wrong answer!!</b></font>";
whichtxt();
}
//trace(numOfCorrect[numOfAns]);
}
//trace("CORRECT");
}
//btn check
btncheck.onPress = function() {
for(var ij=0;ij<3;ij++){
this._root["input"+ij].ijvar= ij;
if(this._root["input"+ij].text== ""){
//trace("u must fill out the field");
//trace(attempt);
var win = showWindow("messageBox");
win.message_txt.text = "You must fill out the field!!!";
}else{
result.text = "";
checkansw();
}
}
}
function whichtxt(){
for(var j=0; j<3;j++){
this["input"+j].jvar = j;
this["input"+j].onSetFocus = tracing;
}
}
function tracing(){
//trace(this);
this.text = "";
}
this is my fla file
www.geocities.com/mrkiey/forum.fla
and this is the preview
www.geocities.com/mrkiey/forum.swf
hope someone will help me out with this…
tq