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

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