home *** CD-ROM | disk | FTP | other *** search
/ FCE Gold Plus / GOLD.iso / pc / shell.swf / scripts / __Packages / com / comp / Fib.as < prev    next >
Encoding:
Text File  |  2007-10-16  |  6.5 KB  |  181 lines

  1. class com.comp.Fib extends MovieClip
  2. {
  3.    var c_txtInpRef;
  4.    function Fib(_objRef, _objInpRef, _objTestRef, _objText, _iBoxPosY, _iPartNo)
  5.    {
  6.       var _loc1_ = this;
  7.       var _loc2_ = _objText;
  8.       super();
  9.       _loc1_.c_txtInpRef = _objInpRef;
  10.       _loc1_.c_objTestRef = _objTestRef;
  11.       _loc1_.c_strCorrAns = _loc2_.data.split("<gap>")[1].split("</gap>")[0];
  12.       _loc1_.c_arrPoint1 = _loc2_.attributes.point1.split("|");
  13.       _loc1_.c_arrPoint2 = _loc2_.attributes.point2.split("|");
  14.       _loc1_.c_iBoxPosY = _iBoxPosY;
  15.       _loc1_.c_iPartNo = _iPartNo;
  16.       _loc1_.c_objRef = _objRef;
  17.       _loc1_.c_strTestMode = _objTestRef.c_strMode;
  18.       _loc1_.init();
  19.    }
  20.    function init()
  21.    {
  22.       var _loc1_ = this;
  23.       var _loc2_ = undefined;
  24.       var strEnvironment = com.controller.UICoordinator.getInstance().getOSEnvironment();
  25.       if(_loc1_.c_objRef.mc_QuestionPanel)
  26.       {
  27.          _loc1_.c_objRef.btn_Next._x = _loc1_.c_objRef.mc_QuestionPanel._width + _loc1_.c_objRef.mc_QuestionPanel._x - _loc1_.c_objRef.btn_Next._width;
  28.          _loc1_.c_objRef.btn_Next._y = _loc1_.c_objRef.mc_QuestionPanel._height + _loc1_.c_objRef.mc_QuestionPanel._y + 7;
  29.       }
  30.       if(_loc1_.c_objRef.mc_resizableBox)
  31.       {
  32.          _loc1_.c_objRef.btn_Next._x = _loc1_.c_objRef.mc_resizableBox._width - _loc1_.c_objRef.btn_Next._width;
  33.          _loc1_.c_objRef.btn_Next._y = _loc1_.c_objRef.mc_resizableBox._height + 5;
  34.       }
  35.       if(_loc1_.c_objTestRef.c_strMode != "Review")
  36.       {
  37.          Selection.setFocus(_loc1_.c_txtInpRef);
  38.          Selection.setSelection(0,_loc1_.c_txtInpRef.length);
  39.          _loc1_.setEvents();
  40.       }
  41.       else if(_loc1_.c_objTestRef.c_strMode == "Review")
  42.       {
  43.          _loc1_.c_objRef.mc_TickCross1.removeMovieClip();
  44.          var tickPositionX = _loc1_.c_objRef.mc_QuestionPanel._x + _loc1_.c_objRef.mc_QuestionPanel._width - 25;
  45.          var tickPositionY = _loc1_.c_txtInpRef._parent._y;
  46.          if(_loc1_.c_iPartNo == 4)
  47.          {
  48.             trace("FFIIBB 2 - CASE c_iPartNo == 4 ");
  49.             _loc1_.c_objRef.attachMovie("mc_TickCross","mc_TickCross1",50,{_x:tickPositionX,_y:tickPositionY + 77});
  50.          }
  51.          else if(strEnvironment == "Linux" && _loc1_.c_iPartNo == 3)
  52.          {
  53.             trace("FFIIBB 2 - CASE c_iPartNo == 4 ");
  54.             _loc1_.c_objRef.attachMovie("mc_TickCross","mc_TickCros1",50,{_x:tickPositionX,_y:tickPositionY + 10});
  55.          }
  56.          else
  57.          {
  58.             trace("FFIIBB 3 - CASE ELSE");
  59.             trace("^^^^^^^^^^^^^^^^^^^^^^^^^^^^Windows MODE");
  60.             _loc1_.c_objRef.attachMovie("mc_TickCross","mc_TickCross1",50,{_x:tickPositionX,_y:tickPositionY + 10});
  61.          }
  62.          var arrCorrAns = _loc1_.c_strCorrAns.split("|");
  63.          var _loc3_ = 0;
  64.          while(_loc3_ < arrCorrAns.length)
  65.          {
  66.             if(!(_loc1_.c_objTestRef.c_objHMObject.attempted != arrCorrAns[_loc3_] || (_loc1_.c_objTestRef.c_objHMObject.attempted == null || _loc1_.c_objTestRef.c_objHMObject.attempted == undefined)))
  67.             {
  68.                _loc2_ = "CORRECT";
  69.                break;
  70.             }
  71.             _loc2_ = "INCORRECT";
  72.             _loc3_ = _loc3_ + 1;
  73.          }
  74.          if(_loc2_ == "INCORRECT")
  75.          {
  76.             _loc3_ = 0;
  77.             while(_loc3_ < _loc1_.c_arrPoint1.length)
  78.             {
  79.                if(_loc1_.c_objTestRef.c_objHMObject.attempted == _loc1_.c_arrPoint1[_loc3_])
  80.                {
  81.                   _loc2_ = "CORRECT";
  82.                   break;
  83.                }
  84.                _loc2_ = "INCORRECT";
  85.                _loc3_ = _loc3_ + 1;
  86.             }
  87.          }
  88.          if(_loc2_ == "INCORRECT")
  89.          {
  90.             _loc3_ = 0;
  91.             while(_loc3_ < _loc1_.c_arrPoint2.length)
  92.             {
  93.                if(_loc1_.c_objTestRef.c_objHMObject.attempted == _loc1_.c_arrPoint2[_loc3_])
  94.                {
  95.                   _loc2_ = "CORRECT";
  96.                   break;
  97.                }
  98.                _loc2_ = "INCORRECT";
  99.                _loc3_ = _loc3_ + 1;
  100.             }
  101.          }
  102.          _loc1_.c_objRef.mc_TickCross1.gotoAndStop(_loc2_);
  103.       }
  104.    }
  105.    function setEvents()
  106.    {
  107.       var _objref = this;
  108.       this.c_txtInpRef.onChanged = function()
  109.       {
  110.          _objref.funKeypressed();
  111.       };
  112.    }
  113.    function funKeypressed()
  114.    {
  115.       var _loc1_ = this;
  116.       var _loc2_ = new Object();
  117.       if(_loc1_.c_txtInpRef.text == "" || _loc1_.c_txtInpRef.text == undefined || _loc1_.c_txtInpRef.text == null)
  118.       {
  119.          _loc1_.c_objRef.btn_Next._visible = false;
  120.          _loc2_.attempted = undefined;
  121.          _loc2_.correct = undefined;
  122.          _loc1_.c_objTestRef.removeQuesObject();
  123.          _loc1_.c_objTestRef.c_objNavigator.markUnAttempted();
  124.       }
  125.       else
  126.       {
  127.          _loc2_.attempted = _loc1_.c_txtInpRef.text;
  128.          var arrCorrAns = _loc1_.c_strCorrAns.split("|");
  129.          var _loc3_ = 0;
  130.          while(_loc3_ < arrCorrAns.length)
  131.          {
  132.             if(_loc1_.c_txtInpRef.text == arrCorrAns[_loc3_])
  133.             {
  134.                _loc2_.correct = 2;
  135.                break;
  136.             }
  137.             _loc2_.correct = 0;
  138.             _loc3_ = _loc3_ + 1;
  139.          }
  140.          if(_loc2_.correct == 0)
  141.          {
  142.             _loc3_ = 0;
  143.             while(_loc3_ < _loc1_.c_arrPoint1.length)
  144.             {
  145.                if(_loc1_.c_txtInpRef.text == _loc1_.c_arrPoint1[_loc3_])
  146.                {
  147.                   _loc2_.correct = 1;
  148.                   break;
  149.                }
  150.                _loc3_ = _loc3_ + 1;
  151.             }
  152.             _loc3_ = 0;
  153.             while(_loc3_ < _loc1_.c_arrPoint2.length)
  154.             {
  155.                if(_loc1_.c_txtInpRef.text == _loc1_.c_arrPoint2[_loc3_])
  156.                {
  157.                   _loc2_.correct = 1;
  158.                   break;
  159.                }
  160.                _loc3_ = _loc3_ + 1;
  161.             }
  162.          }
  163.          _loc1_.c_objTestRef.appendQuesObject(_loc2_);
  164.          _loc1_.c_objTestRef.c_objNavigator.markAttempted();
  165.          if(_loc1_.c_objTestRef.c_objScreenData.DOC.section[_loc1_.c_objTestRef.c_objScreenData.DOC.section.length - 1].question.length != _loc1_.c_objTestRef.c_iQuestionNo)
  166.          {
  167.             _loc1_.c_objRef.btn_Next._visible = true;
  168.          }
  169.          else
  170.          {
  171.             _loc1_.c_objRef.btn_Next._visible = false;
  172.          }
  173.       }
  174.    }
  175.    function freeze()
  176.    {
  177.       this.c_txtInpRef.type = "dynamic";
  178.       this.c_txtInpRef.selectable = false;
  179.    }
  180. }
  181.