home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FCE Gold Plus
/
GOLD.iso
/
pc
/
shell.swf
/
scripts
/
__Packages
/
com
/
comp
/
Fib.as
< prev
next >
Wrap
Text File
|
2007-10-16
|
7KB
|
180 lines
class com.comp.Fib extends MovieClip
{
function Fib(_objRef, _objInpRef, _objTestRef, _objText, _iBoxPosY, _iPartNo)
{
var _loc1_ = this;
var _loc2_ = _objText;
super();
_loc1_.c_txtInpRef = _objInpRef;
_loc1_.c_objTestRef = _objTestRef;
_loc1_.c_strCorrAns = _loc2_.data.split("<gap>")[1].split("</gap>")[0];
_loc1_.c_arrPoint1 = _loc2_.attributes.point1.split("|");
_loc1_.c_arrPoint2 = _loc2_.attributes.point2.split("|");
_loc1_.c_iBoxPosY = _iBoxPosY;
_loc1_.c_iPartNo = _iPartNo;
_loc1_.c_objRef = _objRef;
_loc1_.c_strTestMode = _objTestRef.c_strMode;
_loc1_.init();
}
function init()
{
var _loc1_ = this;
var _loc2_ = undefined;
var strEnvironment = com.controller.UICoordinator.getInstance().getOSEnvironment();
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 tickPositionX = _loc1_.c_objRef.mc_QuestionPanel._x + _loc1_.c_objRef.mc_QuestionPanel._width - 25;
var tickPositionY = _loc1_.c_txtInpRef._parent._y;
if(_loc1_.c_iPartNo == 4)
{
trace("FFIIBB 2 - CASE c_iPartNo == 4 ");
_loc1_.c_objRef.attachMovie("mc_TickCross","mc_TickCross1",50,{_x:tickPositionX,_y:tickPositionY + 77});
}
else if(strEnvironment == "Linux" && _loc1_.c_iPartNo == 3)
{
trace("FFIIBB 2 - CASE c_iPartNo == 4 ");
_loc1_.c_objRef.attachMovie("mc_TickCross","mc_TickCros1",50,{_x:tickPositionX,_y:tickPositionY + 10});
}
else
{
trace("FFIIBB 3 - CASE ELSE");
trace("^^^^^^^^^^^^^^^^^^^^^^^^^^^^Windows MODE");
_loc1_.c_objRef.attachMovie("mc_TickCross","mc_TickCross1",50,{_x:tickPositionX,_y:tickPositionY + 10});
}
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 _objref = this;
this.c_txtInpRef.onChanged = function()
{
_objref.funKeypressed();
};
}
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()
{
this.c_txtInpRef.type = "dynamic";
this.c_txtInpRef.selectable = false;
}
}