home *** CD-ROM | disk | FTP | other *** search
/ FCE Gold Plus / GOLD.iso / pc / shell.swf / scripts / __Packages / com / screen / AutoFillFib.as next >
Text File  |  2007-10-16  |  9KB  |  226 lines

  1. class com.screen.AutoFillFib
  2. {
  3.    function AutoFillFib()
  4.    {
  5.    }
  6.    function init(_objRef, _objSection, _objQuestion, _iheight, _arrFib, _objTestRef)
  7.    {
  8.       var _loc1_ = this;
  9.       var _loc2_ = _objQuestion;
  10.       trace(">>>>>>>>>>>>>> init CALLEEDDDDDDDDD!!!!!!11");
  11.       _loc1_.c_objRef = _objRef;
  12.       _loc1_.c_objSection = _objSection;
  13.       _loc1_.c_objQuestion = _loc2_;
  14.       _loc1_.c_iheight = _iheight;
  15.       _loc1_.c_objTestRef = _objTestRef;
  16.       _loc1_.c_arrFib = _arrFib;
  17.       var _loc3_ = _loc1_.c_arrFib[0].txt_inpTxt;
  18.       var txtBoxObjRef_1 = _loc1_.c_arrFib[1].txt_inpTxt;
  19.       var txtBoxObjRef_2 = _loc1_.c_arrFib[2].txt_inpTxt;
  20.       _loc1_.c_txtInpRef = _loc3_;
  21.       _loc1_.c_txtInpRef_1 = txtBoxObjRef_1;
  22.       _loc1_.c_txtInpRef_2 = txtBoxObjRef_2;
  23.       _loc1_.c_objTestRef = _objTestRef;
  24.       _loc1_.c_strCorrAns = _loc2_.attributes.answer;
  25.       _loc1_.c_arrPoint1 = _loc2_.text.attributes.point1.split("|");
  26.       _loc1_.c_arrPoint2 = _loc2_.text.attributes.point2.split("|");
  27.       _loc1_.c_strTestMode = _objTestRef.c_strMode;
  28.       _loc1_.showFeedBackBox();
  29.       _loc1_.operationFIB();
  30.    }
  31.    function showFeedBackBox()
  32.    {
  33.       var _loc1_ = this;
  34.       _loc1_.c_objRef.txt_header.text = _loc1_.c_objQuestion.attributes.number;
  35.       if(_loc1_.c_objTestRef.c_strMode != "Review")
  36.       {
  37.          _loc1_.c_objRef.mc_resizableBox2._visible = false;
  38.          _loc1_.c_objRef.options._visible = false;
  39.          _loc1_.c_objRef.txt_header2._visible = false;
  40.          _loc1_.c_objRef.btn_closeX._visible = false;
  41.       }
  42.       else
  43.       {
  44.          _loc1_.c_objRef.mc_resizableBox2._visible = true;
  45.          _loc1_.c_objRef.btn_closeX._visible = true;
  46.          var _loc2_ = new com.comp.ResizableBox();
  47.          _loc2_.resizeBox(320,60,_loc1_.c_objRef.mc_resizableBox2);
  48.          _loc1_.c_objRef.options._visible = true;
  49.          _loc1_.c_objRef.txt_header2._visible = true;
  50.          _loc1_.c_objRef.txt_header2.text = "Correct Answer(s)";
  51.          _loc1_.c_objRef.txt_header2.autoSize = "Left";
  52.          _loc1_.c_objRef.options._y = _loc1_.c_objRef.mc_resizableBox2._y + 30;
  53.          _loc1_.c_objRef.options.text = _loc1_.c_objQuestion.attributes.answer;
  54.          _loc1_.c_objRef.options.autoSize = "Left";
  55.          _loc1_.c_objRef.mc_resizableBox2.useHandCursor = false;
  56.          _loc1_.c_objRef.btn_closeX._x = _loc1_.c_objRef.mc_resizableBox2._x + _loc1_.c_objRef.mc_resizableBox2._width - 21;
  57.          _loc1_.c_objRef.btn_closeX._y = _loc1_.c_objRef.txt_header2._y;
  58.       }
  59.    }
  60.    function operationFIB()
  61.    {
  62.       var _loc1_ = this;
  63.       var _loc2_ = undefined;
  64.       if(_loc1_.c_objRef.mc_QuestionPanel)
  65.       {
  66.          _loc1_.c_objRef.btn_Next._x = _loc1_.c_objRef.mc_QuestionPanel._width + _loc1_.c_objRef.mc_QuestionPanel._x - _loc1_.c_objRef.btn_Next._width;
  67.          _loc1_.c_objRef.btn_Next._y = _loc1_.c_objRef.mc_QuestionPanel._height + _loc1_.c_objRef.mc_QuestionPanel._y + 7;
  68.       }
  69.       if(_loc1_.c_objRef.mc_resizableBox)
  70.       {
  71.          _loc1_.c_objRef.btn_Next._x = _loc1_.c_objRef.mc_resizableBox._width - _loc1_.c_objRef.btn_Next._width;
  72.          _loc1_.c_objRef.btn_Next._y = _loc1_.c_objRef.mc_resizableBox._height + 5;
  73.       }
  74.       if(_loc1_.c_objTestRef.c_strMode != "Review")
  75.       {
  76.          Selection.setFocus(_loc1_.c_txtInpRef);
  77.          Selection.setSelection(0,_loc1_.c_txtInpRef.length);
  78.          _loc1_.setEvents();
  79.       }
  80.       else if(_loc1_.c_objTestRef.c_strMode == "Review")
  81.       {
  82.          _loc1_.c_objRef.mc_TickCross1.removeMovieClip();
  83.          var mcTick = _loc1_.c_objRef.attachMovie("mc_TickCross","mc_TickCross1",21);
  84.          mcTick._x = _loc1_.c_objRef.mc_QuestionPanel._x + _loc1_.c_objRef.mc_QuestionPanel._width - 25;
  85.          mcTick._y = _loc1_.c_objRef.mc_QuestionPanel._y + 35;
  86.          var arrCorrAns = _loc1_.c_strCorrAns.split("|");
  87.          var _loc3_ = 0;
  88.          while(_loc3_ < arrCorrAns.length)
  89.          {
  90.             if(!(_loc1_.c_objTestRef.c_objHMObject.attempted != arrCorrAns[_loc3_] || (_loc1_.c_objTestRef.c_objHMObject.attempted == null || _loc1_.c_objTestRef.c_objHMObject.attempted == undefined)))
  91.             {
  92.                _loc2_ = "CORRECT";
  93.                break;
  94.             }
  95.             _loc2_ = "INCORRECT";
  96.             _loc3_ = _loc3_ + 1;
  97.          }
  98.          if(_loc2_ == "INCORRECT")
  99.          {
  100.             _loc3_ = 0;
  101.             while(_loc3_ < _loc1_.c_arrPoint1.length)
  102.             {
  103.                if(_loc1_.c_objTestRef.c_objHMObject.attempted == _loc1_.c_arrPoint1[_loc3_])
  104.                {
  105.                   _loc2_ = "CORRECT";
  106.                   break;
  107.                }
  108.                _loc2_ = "INCORRECT";
  109.                _loc3_ = _loc3_ + 1;
  110.             }
  111.          }
  112.          if(_loc2_ == "INCORRECT")
  113.          {
  114.             _loc3_ = 0;
  115.             while(_loc3_ < _loc1_.c_arrPoint2.length)
  116.             {
  117.                if(_loc1_.c_objTestRef.c_objHMObject.attempted == _loc1_.c_arrPoint2[_loc3_])
  118.                {
  119.                   _loc2_ = "CORRECT";
  120.                   break;
  121.                }
  122.                _loc2_ = "INCORRECT";
  123.                _loc3_ = _loc3_ + 1;
  124.             }
  125.          }
  126.          _loc1_.c_objRef.mc_TickCross1.gotoAndStop(_loc2_);
  127.       }
  128.    }
  129.    function setEvents()
  130.    {
  131.       var _loc2_ = this;
  132.       var _objRef = _loc2_;
  133.       var _loc1_ = 0;
  134.       while(_loc1_ < _loc2_.c_arrFib.length)
  135.       {
  136.          var txtFieldFib = _loc2_.c_arrFib[_loc1_].txt_inpTxt;
  137.          txtFieldFib.onChanged = function()
  138.          {
  139.             var _loc1_ = this.text;
  140.             _objRef.assignValFib(_loc1_,this);
  141.             _objRef.funKeypressed();
  142.          };
  143.          _loc1_ = _loc1_ + 1;
  144.       }
  145.    }
  146.    function assignValFib(fibText, txtFieldFib)
  147.    {
  148.       var _loc1_ = this;
  149.       var _loc2_ = fibText;
  150.       _loc1_.c_arrFib[0].txt_inpTxt.text = _loc2_;
  151.       _loc1_.c_arrFib[1].txt_inpTxt.text = _loc2_;
  152.       _loc1_.c_arrFib[2].txt_inpTxt.text = _loc2_;
  153.    }
  154.    function funKeypressed()
  155.    {
  156.       var _loc1_ = this;
  157.       var _loc2_ = new Object();
  158.       if(_loc1_.c_txtInpRef.text == "" || _loc1_.c_txtInpRef.text == undefined || _loc1_.c_txtInpRef.text == null)
  159.       {
  160.          _loc1_.c_objRef.btn_Next._visible = false;
  161.          _loc2_.attempted = undefined;
  162.          _loc2_.correct = undefined;
  163.          _loc1_.c_objTestRef.removeQuesObject();
  164.          _loc1_.c_objTestRef.c_objNavigator.markUnAttempted();
  165.       }
  166.       else
  167.       {
  168.          _loc2_.attempted = _loc1_.c_txtInpRef.text;
  169.          var arrCorrAns = _loc1_.c_strCorrAns.split("|");
  170.          var _loc3_ = 0;
  171.          while(_loc3_ < arrCorrAns.length)
  172.          {
  173.             if(_loc1_.c_txtInpRef.text == arrCorrAns[_loc3_])
  174.             {
  175.                _loc2_.correct = 2;
  176.                break;
  177.             }
  178.             _loc2_.correct = 0;
  179.             _loc3_ = _loc3_ + 1;
  180.          }
  181.          if(_loc2_.correct == 0)
  182.          {
  183.             _loc3_ = 0;
  184.             while(_loc3_ < _loc1_.c_arrPoint1.length)
  185.             {
  186.                if(_loc1_.c_txtInpRef.text == _loc1_.c_arrPoint1[_loc3_])
  187.                {
  188.                   _loc2_.correct = 1;
  189.                   break;
  190.                }
  191.                _loc3_ = _loc3_ + 1;
  192.             }
  193.             _loc3_ = 0;
  194.             while(_loc3_ < _loc1_.c_arrPoint2.length)
  195.             {
  196.                if(_loc1_.c_txtInpRef.text == _loc1_.c_arrPoint2[_loc3_])
  197.                {
  198.                   _loc2_.correct = 1;
  199.                   break;
  200.                }
  201.                _loc3_ = _loc3_ + 1;
  202.             }
  203.          }
  204.          _loc1_.c_objTestRef.appendQuesObject(_loc2_);
  205.          _loc1_.c_objTestRef.c_objNavigator.markAttempted();
  206.          if(_loc1_.c_objTestRef.c_objScreenData.DOC.section[_loc1_.c_objTestRef.c_objScreenData.DOC.section.length - 1].question.length != _loc1_.c_objTestRef.c_iQuestionNo)
  207.          {
  208.             _loc1_.c_objRef.btn_Next._visible = true;
  209.          }
  210.          else
  211.          {
  212.             _loc1_.c_objRef.btn_Next._visible = false;
  213.          }
  214.       }
  215.    }
  216.    function freeze()
  217.    {
  218.       var _loc1_ = this;
  219.       _level101.txt_Tracer7.text += "\n FREWWWWZZZZZZZZZZZZZZZZZZZ";
  220.       _loc1_.c_txtInpRef.type = "dynamic";
  221.       _loc1_.c_txtInpRef.selectable = false;
  222.       _loc1_.c_txtInpRef_1.selectable = false;
  223.       _loc1_.c_txtInpRef_2.selectable = false;
  224.    }
  225. }
  226.