home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FCE Gold Plus
/
GOLD.iso
/
pc
/
shell.swf
/
scripts
/
__Packages
/
com
/
screen
/
AutoFillFib.as
next >
Wrap
Text File
|
2007-10-16
|
9KB
|
226 lines
class com.screen.AutoFillFib
{
function AutoFillFib()
{
}
function init(_objRef, _objSection, _objQuestion, _iheight, _arrFib, _objTestRef)
{
var _loc1_ = this;
var _loc2_ = _objQuestion;
trace(">>>>>>>>>>>>>> init CALLEEDDDDDDDDD!!!!!!11");
_loc1_.c_objRef = _objRef;
_loc1_.c_objSection = _objSection;
_loc1_.c_objQuestion = _loc2_;
_loc1_.c_iheight = _iheight;
_loc1_.c_objTestRef = _objTestRef;
_loc1_.c_arrFib = _arrFib;
var _loc3_ = _loc1_.c_arrFib[0].txt_inpTxt;
var txtBoxObjRef_1 = _loc1_.c_arrFib[1].txt_inpTxt;
var txtBoxObjRef_2 = _loc1_.c_arrFib[2].txt_inpTxt;
_loc1_.c_txtInpRef = _loc3_;
_loc1_.c_txtInpRef_1 = txtBoxObjRef_1;
_loc1_.c_txtInpRef_2 = txtBoxObjRef_2;
_loc1_.c_objTestRef = _objTestRef;
_loc1_.c_strCorrAns = _loc2_.attributes.answer;
_loc1_.c_arrPoint1 = _loc2_.text.attributes.point1.split("|");
_loc1_.c_arrPoint2 = _loc2_.text.attributes.point2.split("|");
_loc1_.c_strTestMode = _objTestRef.c_strMode;
_loc1_.showFeedBackBox();
_loc1_.operationFIB();
}
function showFeedBackBox()
{
var _loc1_ = this;
_loc1_.c_objRef.txt_header.text = _loc1_.c_objQuestion.attributes.number;
if(_loc1_.c_objTestRef.c_strMode != "Review")
{
_loc1_.c_objRef.mc_resizableBox2._visible = false;
_loc1_.c_objRef.options._visible = false;
_loc1_.c_objRef.txt_header2._visible = false;
_loc1_.c_objRef.btn_closeX._visible = false;
}
else
{
_loc1_.c_objRef.mc_resizableBox2._visible = true;
_loc1_.c_objRef.btn_closeX._visible = true;
var _loc2_ = new com.comp.ResizableBox();
_loc2_.resizeBox(320,60,_loc1_.c_objRef.mc_resizableBox2);
_loc1_.c_objRef.options._visible = true;
_loc1_.c_objRef.txt_header2._visible = true;
_loc1_.c_objRef.txt_header2.text = "Correct Answer(s)";
_loc1_.c_objRef.txt_header2.autoSize = "Left";
_loc1_.c_objRef.options._y = _loc1_.c_objRef.mc_resizableBox2._y + 30;
_loc1_.c_objRef.options.text = _loc1_.c_objQuestion.attributes.answer;
_loc1_.c_objRef.options.autoSize = "Left";
_loc1_.c_objRef.mc_resizableBox2.useHandCursor = false;
_loc1_.c_objRef.btn_closeX._x = _loc1_.c_objRef.mc_resizableBox2._x + _loc1_.c_objRef.mc_resizableBox2._width - 21;
_loc1_.c_objRef.btn_closeX._y = _loc1_.c_objRef.txt_header2._y;
}
}
function operationFIB()
{
var _loc1_ = this;
var _loc2_ = undefined;
if(_loc1_.c_objRef.mc_QuestionPanel)
{
_loc1_.c_objRef.btn_Next._x = _loc1_.c_objRef.mc_QuestionPanel._width + _loc1_.c_objRef.mc_QuestionPanel._x - _loc1_.c_objRef.btn_Next._width;
_loc1_.c_objRef.btn_Next._y = _loc1_.c_objRef.mc_QuestionPanel._height + _loc1_.c_objRef.mc_QuestionPanel._y + 7;
}
if(_loc1_.c_objRef.mc_resizableBox)
{
_loc1_.c_objRef.btn_Next._x = _loc1_.c_objRef.mc_resizableBox._width - _loc1_.c_objRef.btn_Next._width;
_loc1_.c_objRef.btn_Next._y = _loc1_.c_objRef.mc_resizableBox._height + 5;
}
if(_loc1_.c_objTestRef.c_strMode != "Review")
{
Selection.setFocus(_loc1_.c_txtInpRef);
Selection.setSelection(0,_loc1_.c_txtInpRef.length);
_loc1_.setEvents();
}
else if(_loc1_.c_objTestRef.c_strMode == "Review")
{
_loc1_.c_objRef.mc_TickCross1.removeMovieClip();
var mcTick = _loc1_.c_objRef.attachMovie("mc_TickCross","mc_TickCross1",21);
mcTick._x = _loc1_.c_objRef.mc_QuestionPanel._x + _loc1_.c_objRef.mc_QuestionPanel._width - 25;
mcTick._y = _loc1_.c_objRef.mc_QuestionPanel._y + 35;
var arrCorrAns = _loc1_.c_strCorrAns.split("|");
var _loc3_ = 0;
while(_loc3_ < arrCorrAns.length)
{
if(!(_loc1_.c_objTestRef.c_objHMObject.attempted != arrCorrAns[_loc3_] || (_loc1_.c_objTestRef.c_objHMObject.attempted == null || _loc1_.c_objTestRef.c_objHMObject.attempted == undefined)))
{
_loc2_ = "CORRECT";
break;
}
_loc2_ = "INCORRECT";
_loc3_ = _loc3_ + 1;
}
if(_loc2_ == "INCORRECT")
{
_loc3_ = 0;
while(_loc3_ < _loc1_.c_arrPoint1.length)
{
if(_loc1_.c_objTestRef.c_objHMObject.attempted == _loc1_.c_arrPoint1[_loc3_])
{
_loc2_ = "CORRECT";
break;
}
_loc2_ = "INCORRECT";
_loc3_ = _loc3_ + 1;
}
}
if(_loc2_ == "INCORRECT")
{
_loc3_ = 0;
while(_loc3_ < _loc1_.c_arrPoint2.length)
{
if(_loc1_.c_objTestRef.c_objHMObject.attempted == _loc1_.c_arrPoint2[_loc3_])
{
_loc2_ = "CORRECT";
break;
}
_loc2_ = "INCORRECT";
_loc3_ = _loc3_ + 1;
}
}
_loc1_.c_objRef.mc_TickCross1.gotoAndStop(_loc2_);
}
}
function setEvents()
{
var _loc2_ = this;
var _objRef = _loc2_;
var _loc1_ = 0;
while(_loc1_ < _loc2_.c_arrFib.length)
{
var txtFieldFib = _loc2_.c_arrFib[_loc1_].txt_inpTxt;
txtFieldFib.onChanged = function()
{
var _loc1_ = this.text;
_objRef.assignValFib(_loc1_,this);
_objRef.funKeypressed();
};
_loc1_ = _loc1_ + 1;
}
}
function assignValFib(fibText, txtFieldFib)
{
var _loc1_ = this;
var _loc2_ = fibText;
_loc1_.c_arrFib[0].txt_inpTxt.text = _loc2_;
_loc1_.c_arrFib[1].txt_inpTxt.text = _loc2_;
_loc1_.c_arrFib[2].txt_inpTxt.text = _loc2_;
}
function funKeypressed()
{
var _loc1_ = this;
var _loc2_ = new Object();
if(_loc1_.c_txtInpRef.text == "" || _loc1_.c_txtInpRef.text == undefined || _loc1_.c_txtInpRef.text == null)
{
_loc1_.c_objRef.btn_Next._visible = false;
_loc2_.attempted = undefined;
_loc2_.correct = undefined;
_loc1_.c_objTestRef.removeQuesObject();
_loc1_.c_objTestRef.c_objNavigator.markUnAttempted();
}
else
{
_loc2_.attempted = _loc1_.c_txtInpRef.text;
var arrCorrAns = _loc1_.c_strCorrAns.split("|");
var _loc3_ = 0;
while(_loc3_ < arrCorrAns.length)
{
if(_loc1_.c_txtInpRef.text == arrCorrAns[_loc3_])
{
_loc2_.correct = 2;
break;
}
_loc2_.correct = 0;
_loc3_ = _loc3_ + 1;
}
if(_loc2_.correct == 0)
{
_loc3_ = 0;
while(_loc3_ < _loc1_.c_arrPoint1.length)
{
if(_loc1_.c_txtInpRef.text == _loc1_.c_arrPoint1[_loc3_])
{
_loc2_.correct = 1;
break;
}
_loc3_ = _loc3_ + 1;
}
_loc3_ = 0;
while(_loc3_ < _loc1_.c_arrPoint2.length)
{
if(_loc1_.c_txtInpRef.text == _loc1_.c_arrPoint2[_loc3_])
{
_loc2_.correct = 1;
break;
}
_loc3_ = _loc3_ + 1;
}
}
_loc1_.c_objTestRef.appendQuesObject(_loc2_);
_loc1_.c_objTestRef.c_objNavigator.markAttempted();
if(_loc1_.c_objTestRef.c_objScreenData.DOC.section[_loc1_.c_objTestRef.c_objScreenData.DOC.section.length - 1].question.length != _loc1_.c_objTestRef.c_iQuestionNo)
{
_loc1_.c_objRef.btn_Next._visible = true;
}
else
{
_loc1_.c_objRef.btn_Next._visible = false;
}
}
}
function freeze()
{
var _loc1_ = this;
_level101.txt_Tracer7.text += "\n FREWWWWZZZZZZZZZZZZZZZZZZZ";
_loc1_.c_txtInpRef.type = "dynamic";
_loc1_.c_txtInpRef.selectable = false;
_loc1_.c_txtInpRef_1.selectable = false;
_loc1_.c_txtInpRef_2.selectable = false;
}
}