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

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