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

  1. class com.screen.PairedDropDown extends com.screen.FIB2
  2. {
  3.    var c_objSection;
  4.    var c_strEnvironment;
  5.    var iWidth;
  6.    var c_arrQuesNos;
  7.    var c_iDepth;
  8.    var fib;
  9.    var strText;
  10.    var objRef;
  11.    var c_btnShowPrevious;
  12.    var c_btnShowCurrent;
  13.    var _parent;
  14.    var iLevel = 1;
  15.    var btnNo = 0;
  16.    function PairedDropDown()
  17.    {
  18.       super();
  19.    }
  20.    function init(_objRef, _objSection, _title, _text, _wth, x, y, _mcName, _type, _group, _navRef)
  21.    {
  22.       var _loc1_ = this;
  23.       _loc1_.objRef = _objRef;
  24.       _loc1_.c_objSection = _objSection;
  25.       _loc1_.strTitle = _title;
  26.       _loc1_.strText = _text;
  27.       _loc1_.iWidth = _wth;
  28.       _loc1_.xLoc = x;
  29.       _loc1_.yLoc = y;
  30.       _loc1_.c_strAthMC = _mcName;
  31.       _loc1_.c_strType = _type;
  32.       _loc1_.c_iGroup = _group;
  33.       _loc1_.c_objNavRef = _navRef;
  34.       _loc1_.c_strMode = _loc1_.c_objNavRef.c_objTestRef.c_strMode;
  35.       _loc1_.c_strSkill = _loc1_.c_objNavRef.c_objTestRef.c_strSkill;
  36.       _loc1_.c_objHMObj = _loc1_.c_objNavRef.c_objTestRef.c_hQuestionState;
  37.       _loc1_.c_strEnvironment = com.controller.UICoordinator.getInstance().getOSEnvironment();
  38.       _loc1_.startProcess();
  39.    }
  40.    function startProcess()
  41.    {
  42.       var _loc1_ = this;
  43.       var _loc2_ = _loc1_.c_objSection.question;
  44.       _loc1_.objRef.mc_feedbackBox._visible = false;
  45.       var mcScrollPane = _loc1_.objRef.attachMovie("FScrollPaneSymbol","mc_ScrollPane",_loc1_.objRef.getNextHighestDepth());
  46.       _loc1_.objRef.mc_ScrollPane.setScrollContent("SP_Content");
  47.       _loc1_.objRef.fib = _loc1_.objRef.mc_ScrollPane.getScrollContent();
  48.       _loc1_.fib = _loc1_.objRef.fib;
  49.       _loc1_.fib._x = _loc1_.xLoc;
  50.       _loc1_.fib._y = _loc1_.yLoc;
  51.       _loc1_.displayTitle();
  52.       _loc1_.displayText(_loc2_);
  53.       _loc1_.fillComboData(_loc1_.fib,_loc2_);
  54.       _loc1_.setComboValues(_loc2_);
  55.       _loc1_.displaySelectionClip();
  56.       _loc1_.displayShowCorrectButtons();
  57.       _loc1_.showHideSCButtons(false);
  58.    }
  59.    function displayTitle(iScrollSizeWidth)
  60.    {
  61.       var _loc2_ = this;
  62.       _loc2_.objRef.mc_textOnlyScrollBar._x = _loc2_.objRef.mc_EmptyTxtOnly._x;
  63.       _loc2_.objRef.mc_textOnlyScrollBar._y = _loc2_.objRef.mc_EmptyTxtOnly._y;
  64.       _loc2_.objRef.mc_textOnlyScrollBar.setSize(_loc2_.objRef.mc_EmptyTxtOnly._width - 1,_loc2_.objRef.mc_EmptyTxtOnly._height - 1);
  65.       _loc2_.objRef.mc_textOnlyScrollBar.setScrollContent("SP_Content");
  66.       var fibTextOnly = _loc2_.objRef.mc_textOnlyScrollBar.getScrollContent();
  67.       fibTextOnly.createTextField("title",10000,10,0,_loc2_.iWidth,25);
  68.       var _loc1_ = fibTextOnly.title;
  69.       var _loc3_ = new TextFormat();
  70.       _loc1_.autoSize = true;
  71.       _loc1_.html = true;
  72.       _loc1_.htmlText = _loc2_.strTitle;
  73.       _loc1_.multiline = true;
  74.       _loc1_.selectable = false;
  75.       _loc1_.wordWrap = true;
  76.       _loc3_.font = "Verdana";
  77.       _loc3_.size = 11;
  78.       _loc3_.color = "0x000000";
  79.       _loc3_.align = "Left";
  80.       _loc3_.multiline = true;
  81.       _loc3_.wordWrap = true;
  82.       if(_loc2_.c_strEnvironment == "Linux")
  83.       {
  84.          _loc1_.embedFonts = true;
  85.       }
  86.       _loc1_.autoSize = true;
  87.       _loc1_.html = true;
  88.       _loc1_.htmlText = _loc2_.strTitle;
  89.       _loc1_.selectable = false;
  90.       _loc1_.setTextFormat(_loc3_);
  91.       false;
  92.       var strAlignment = _loc2_.getAlignment();
  93.       if(strAlignment == "center")
  94.       {
  95.          _loc1_._x = (_loc2_.iWidth - _loc1_.textWidth) / 2;
  96.       }
  97.       else if(strAlignment == "right")
  98.       {
  99.          _loc1_._x = _loc2_.iWidth - _loc1_.textWidth;
  100.       }
  101.       _loc1_._y += 10;
  102.       _loc1_._visible = false;
  103.       _loc2_.c_objTitle = _loc1_;
  104.       _loc2_.objRef.mc_textOnlyScrollBar.refreshPane();
  105.       false;
  106.       delete strAlignment;
  107.    }
  108.    function getAlignment()
  109.    {
  110.       var _loc1_ = this.c_objSection.textTitle.attributes.textAlign;
  111.       return _loc1_;
  112.    }
  113.    function displayText(arrQuestions)
  114.    {
  115.       var _loc1_ = this;
  116.       clearInterval(_loc1_.c_objInterval);
  117.       _loc1_.c_objTitle._visible = true;
  118.       _loc1_.c_arrQuesNos = new Array();
  119.       var arrData = _loc1_.arrangetext();
  120.       var iMC_Width = 0;
  121.       var iMC_X;
  122.       var iMC_Y;
  123.       if(_loc1_.c_strType == "textField")
  124.       {
  125.          iMC_X = 20;
  126.          iMC_Y = 12;
  127.       }
  128.       else if(_loc1_.c_strType == "Button")
  129.       {
  130.          iMC_X = 10;
  131.          iMC_Y = 12;
  132.       }
  133.       else
  134.       {
  135.          iMC_X = 10;
  136.          iMC_Y = 5;
  137.       }
  138.       var objTF = new TextFormat();
  139.       objTF.font = "Verdana";
  140.       objTF.size = 11;
  141.       objTF.color = "0x000000";
  142.       var i = 0;
  143.       while(i < arrData.length)
  144.       {
  145.          var strText = arrData[i];
  146.          if(i % 2 == 1)
  147.          {
  148.             if(strText != "")
  149.             {
  150.                var _loc3_ = _loc1_.createDropBox(strText,i,iMC_X,iMC_Y);
  151.                _loc3_.strCorrectAnswer = _loc1_.getCorrectAnswer(_loc1_.btnNo);
  152.                _loc3_.answered = "no";
  153.                _loc3_.ID = _loc1_.getQueNo(_loc1_.btnNo);
  154.                if(_loc1_.c_strType == "Button" || _loc1_.c_strType == "MovieClip")
  155.                {
  156.                   var iBoxWith = _loc3_._width - 12;
  157.                }
  158.                else
  159.                {
  160.                   var iBoxWith = _loc3_._width;
  161.                }
  162.                iMC_X += iBoxWith;
  163.                iMC_Width += iBoxWith;
  164.                if(iMC_X > _loc1_.iWidth)
  165.                {
  166.                   if(_loc1_.c_strType == "textField")
  167.                   {
  168.                      iMC_X = iBoxWith + 20;
  169.                   }
  170.                   else
  171.                   {
  172.                      iMC_X = iBoxWith + 10;
  173.                   }
  174.                   iMC_Width = iBoxWith;
  175.                   iMC_Y += _loc1_.iLineSp;
  176.                   if(_loc1_.c_strType == "textField")
  177.                   {
  178.                      _loc3_._x = 20;
  179.                   }
  180.                   else
  181.                   {
  182.                      _loc3_._x = 10;
  183.                   }
  184.                   _loc3_._y = iMC_Y;
  185.                }
  186.                _loc1_.displayPreMode(_loc3_);
  187.                _loc1_.addEventToDropDown(_loc3_,_loc1_.objRef);
  188.                _loc1_.btnNo = _loc1_.btnNo + 1;
  189.             }
  190.          }
  191.          else if(i % 2 == 0)
  192.          {
  193.             var arrTmp = strText.split(" ");
  194.             var tmpWidth = iMC_Width;
  195.             var strNewLine = false;
  196.             _loc1_.fib.createTextField("text" + i,i,iMC_X,iMC_Y,10,20);
  197.             var _loc2_ = _loc1_.fib["text" + i];
  198.             _loc2_.text = "";
  199.             var objOutput = _loc1_.populateText(arrTmp,_loc2_,objTF,iMC_Width,tmpWidth,strNewLine);
  200.             strNewLine = objOutput.strNewLine;
  201.             var j = objOutput.j;
  202.             iMC_Width = objOutput.iMC_Width;
  203.             _loc2_.text = _loc2_.text.substr(0,_loc2_.text.length - 1);
  204.             _loc2_.autoSize = true;
  205.             var strTmp = "";
  206.             arrData = _loc1_.updateTextField(j,arrTmp,strTmp,strNewLine,_loc2_,arrData,i);
  207.             if(_loc1_.c_strEnvironment == "Linux")
  208.             {
  209.                _loc2_.embedFonts = true;
  210.             }
  211.             delete j;
  212.             _loc2_._width = 10;
  213.             _loc2_.html = true;
  214.             _loc2_.htmlText = _loc2_.text;
  215.             _loc2_.autoSize = true;
  216.             _loc2_.setTextFormat(objTF);
  217.             iMC_X += _loc2_._width;
  218.             if(iMC_Width > _loc1_.iWidth || strNewLine)
  219.             {
  220.                if(_loc1_.c_strType == "textField")
  221.                {
  222.                   iMC_X = 20;
  223.                }
  224.                else
  225.                {
  226.                   iMC_X = 10;
  227.                }
  228.                iMC_Width = 0;
  229.                iMC_Y += _loc1_.iLineSp;
  230.             }
  231.          }
  232.          i++;
  233.       }
  234.       _loc1_.objRef.mc_ScrollPane.refreshPane();
  235.       _loc1_.objRef.mc_ScrollPane.setSize(_loc1_.objRef.mc_scrollRefrence._width - 1,_loc1_.objRef.mc_scrollRefrence._height - 1);
  236.       _loc1_.objRef.mc_ScrollPane._x = _loc1_.objRef.mc_scrollRefrence._x;
  237.       _loc1_.objRef.mc_ScrollPane._y = _loc1_.objRef.mc_scrollRefrence._y + 1;
  238.       _loc1_.c_iDepth = arrData.length;
  239.       delete objTF;
  240.    }
  241.    function updateTextField(in_j, arrTmp, strTmp, strNewLine, tField, arrData, in_iIndex)
  242.    {
  243.       var _loc1_ = in_j;
  244.       var _loc2_ = strTmp;
  245.       var _loc3_ = arrTmp;
  246.       _loc1_;
  247.       while(_loc1_ < _loc3_.length)
  248.       {
  249.          _loc2_ = _loc2_ + _loc3_[_loc1_] + " ";
  250.          _loc1_ = _loc1_ + 1;
  251.       }
  252.       _loc2_ = _loc2_.substr(0,_loc2_.length - 1);
  253.       if(_loc2_.length > 0)
  254.       {
  255.          if(this.c_strEnvironment == "Linux")
  256.          {
  257.             tField.embedFonts = true;
  258.          }
  259.          if(!strNewLine)
  260.          {
  261.             tField.text = tField.text.substr(0,tField.text.length - _loc2_.split(" ")[0].length);
  262.          }
  263.          else
  264.          {
  265.             tField.text = tField.text.substr(0,tField.text.length - 2);
  266.          }
  267.          arrData = this.updateArray(arrData,_loc2_,in_iIndex);
  268.       }
  269.       return arrData;
  270.    }
  271.    function populateText(arrTmp, tField, objTF, iMC_Width, tmpWidth, strNewLine)
  272.    {
  273.       var _loc1_ = tField;
  274.       var _loc3_ = arrTmp;
  275.       var objOutput = new Object();
  276.       var _loc2_ = 0;
  277.       while(_loc2_ < _loc3_.length)
  278.       {
  279.          if(this.c_strEnvironment == "Linux")
  280.          {
  281.             _loc1_.embedFonts = true;
  282.          }
  283.          _loc1_.text = _loc1_.text + _loc3_[_loc2_] + " ";
  284.          _loc1_.type = "dynamic";
  285.          _loc1_.selectable = false;
  286.          _loc1_.setTextFormat(objTF);
  287.          _loc1_.autoSize = true;
  288.          iMC_Width = tmpWidth + _loc1_._width;
  289.          if(iMC_Width > this.iWidth)
  290.          {
  291.             break;
  292.          }
  293.          if(_loc3_[_loc2_] == "<p></p>")
  294.          {
  295.             _loc2_ = _loc2_ + 1;
  296.             strNewLine = true;
  297.             break;
  298.          }
  299.          _loc2_ = _loc2_ + 1;
  300.       }
  301.       objOutput.j = _loc2_;
  302.       objOutput.strNewLine = strNewLine;
  303.       objOutput.iMC_Width = iMC_Width;
  304.       return objOutput;
  305.    }
  306.    function createDropBox(in_strText, in_nIndex, in_iMC_X, in_iMC_Y)
  307.    {
  308.       var _loc2_ = this;
  309.       var _loc1_ = _loc2_.fib.attachMovie(_loc2_.c_strAthMC,"Box" + _loc2_.btnNo,in_nIndex);
  310.       _loc2_.c_arrQuesNos.push(in_strText);
  311.       var questObj = _loc2_.c_objSection.question[_loc2_.btnNo];
  312.       var _loc3_ = questObj.attributes.paired;
  313.       var questID = questObj.attributes.number;
  314.       if(_loc3_ != undefined || _loc3_ != null)
  315.       {
  316.          if(_loc3_ < questID)
  317.          {
  318.             _loc1_._x = _loc2_.fib["Box" + (_loc2_.btnNo - 1)]._x;
  319.          }
  320.          else
  321.          {
  322.             _loc1_._x = in_iMC_X;
  323.          }
  324.       }
  325.       else
  326.       {
  327.          _loc1_._x = in_iMC_X;
  328.       }
  329.       _loc1_._y = in_iMC_Y;
  330.       _loc1_.setSize(45,22);
  331.       return _loc1_;
  332.    }
  333.    function displayPreMode(in_objBox)
  334.    {
  335.       var _loc1_ = this;
  336.       if(_loc1_.c_strMode == "Review")
  337.       {
  338.          var iQuesNum = _loc1_.getQueNo(_loc1_.btnNo);
  339.          var objHMQues = _loc1_.c_objHMObj["get"](_loc1_.c_strSkill + "_" + iQuesNum);
  340.          var strCorrect = objHMQues.correct;
  341.          var _loc2_ = in_objBox.attachMovie("mc_TickCrossL","mc_TickCross",100);
  342.          _loc2_.gotoAndStop("BLANK");
  343.          if(strCorrect == "1")
  344.          {
  345.             _loc2_.gotoAndStop("CORRECT");
  346.          }
  347.          else
  348.          {
  349.             _loc2_.gotoAndStop("INCORRECT");
  350.          }
  351.          _loc2_._x = 495 - in_objBox._x;
  352.       }
  353.       else if(_loc1_.c_strMode == "Continue")
  354.       {
  355.          var iQuesNum = _loc1_.getQueNo(_loc1_.btnNo);
  356.          var objHMQues = _loc1_.c_objHMObj["get"](_loc1_.c_strSkill + "_" + iQuesNum);
  357.          var _loc3_ = objHMQues.attempted;
  358.          if(_loc3_ != null || _loc3_ != undefined)
  359.          {
  360.             in_objBox.answered = "yes";
  361.             in_objBox.setSelectedIndex(_loc3_);
  362.          }
  363.          else
  364.          {
  365.             in_objBox.answered = "no";
  366.             in_objBox.setSelectedIndex(_loc3_);
  367.          }
  368.       }
  369.    }
  370.    function fillComboData(objScrollContent, arrQuestions)
  371.    {
  372.       var iQueLen = arrQuestions.length;
  373.       var _loc2_ = 0;
  374.       while(_loc2_ < iQueLen)
  375.       {
  376.          var arrComboData = new Array();
  377.          var queTextChoicesLen = arrQuestions[_loc2_].choices.choice.length;
  378.          var _loc1_ = 0;
  379.          while(_loc1_ < queTextChoicesLen)
  380.          {
  381.             var queData = arrQuestions[_loc2_].choices.choice[_loc1_].data;
  382.             var _loc3_ = arrQuestions[_loc2_].choices.choice[_loc1_].attributes.id;
  383.             arrComboData.push({label:queData,data:_loc3_});
  384.             _loc1_ = _loc1_ + 1;
  385.          }
  386.          objScrollContent["Box" + _loc2_].setDataProvider(arrComboData);
  387.          _loc2_ = _loc2_ + 1;
  388.       }
  389.    }
  390.    function setComboValues(arrQuestions)
  391.    {
  392.       var _loc2_ = this;
  393.       var _loc1_ = 0;
  394.       while(_loc1_ < arrQuestions.length)
  395.       {
  396.          var strQuestionID = arrQuestions[_loc1_].attributes.number;
  397.          var _loc3_ = _loc2_.c_objHMObj["get"](String(_loc2_.c_strSkill + "_" + strQuestionID));
  398.          if(_loc3_.attempted != null || _loc3_.attempted != undefined)
  399.          {
  400.             _loc2_.fib["Box" + _loc1_].setSelectedIndex(_loc3_.attempted);
  401.             _loc2_.fib["Box" + _loc1_].answered = "yes";
  402.          }
  403.          else
  404.          {
  405.             _loc2_.fib["Box" + _loc1_].setSelectedIndex(null);
  406.             _loc2_.fib["Box" + _loc1_].answered = "no";
  407.          }
  408.          _loc1_ = _loc1_ + 1;
  409.       }
  410.    }
  411.    function displaySelectionClip()
  412.    {
  413.       var iTotalQuestions = this.c_arrQuesNos.length;
  414.       var mcSelectionClipHolder = this.fib.createEmptyMovieClip("mcSelectionClipHolder",this.c_iDepth + 1);
  415.       var _loc1_ = 1;
  416.       while(_loc1_ <= iTotalQuestions)
  417.       {
  418.          var _loc2_ = mcSelectionClipHolder.attachMovie("mcComboSelection","mcSelectionRect_" + _loc1_,_loc1_);
  419.          var _loc3_ = this.fib["Box" + (_loc1_ - 1)];
  420.          _loc2_._x = _loc3_._x - 1;
  421.          _loc2_._y = _loc3_._y - 1;
  422.          _loc1_ = _loc1_ + 1;
  423.       }
  424.       this.deselectAllCombo();
  425.    }
  426.    function displayShowCorrectButtons()
  427.    {
  428.       var _loc1_ = this;
  429.       var objRef = _loc1_;
  430.       var iTotalQuestions = _loc1_.c_arrQuesNos.length;
  431.       var iScrollPaneWidth = _loc1_.objRef.mc_ScrollPane._width;
  432.       var mcSCHolder = _loc1_.fib.createEmptyMovieClip("mcSCHolder",_loc1_.c_iDepth + 2);
  433.       trace(_loc1_.fib.mcSCHolder);
  434.       var _loc3_ = 1;
  435.       while(_loc3_ <= iTotalQuestions)
  436.       {
  437.          var _loc2_ = mcSCHolder.attachMovie("mc_showbtn","mc_ShowButton_" + _loc3_,_loc3_);
  438.          _loc2_.gotoAndStop("NORMAL");
  439.          var mcBox = _loc1_.fib["Box" + (_loc3_ - 1)];
  440.          _loc2_._x = iScrollPaneWidth - _loc2_._width - 40;
  441.          _loc2_._y = mcBox._y + 1;
  442.          _loc2_.objRef = _loc1_;
  443.          _loc2_.onRelease = function()
  444.          {
  445.             var _loc1_ = this;
  446.             _loc1_.gotoAndStop("CLICKED");
  447.             _loc1_.enabled = false;
  448.             var _loc2_ = Number(_loc1_._name.split("_")[2]);
  449.             _loc1_.objRef.c_btnShowPrevious = _loc1_.objRef.c_btnShowCurrent;
  450.             _loc1_.objRef.c_btnShowCurrent = _loc1_;
  451.             _loc1_.objRef.showCurrectAnswer(_loc2_ - 1,true);
  452.             _loc1_.objRef.showNavigationSelection(_loc2_ - 1);
  453.             trace("*********************************** Pair - iID : " + _loc2_);
  454.             _loc1_.objRef.showComboSelection(_loc2_);
  455.          };
  456.          _loc3_ = _loc3_ + 1;
  457.       }
  458.    }
  459.    function showHideSCButtons(bVisible)
  460.    {
  461.       var _loc3_ = this.c_arrQuesNos.length;
  462.       var _loc1_ = 1;
  463.       while(_loc1_ <= _loc3_)
  464.       {
  465.          var _loc2_ = this.fib.mcSCHolder["mc_ShowButton_" + _loc1_];
  466.          _loc2_._visible = bVisible;
  467.          _loc1_ = _loc1_ + 1;
  468.       }
  469.    }
  470.    function navBtnClicked(_iCurrQuestion)
  471.    {
  472.       var _loc1_ = this;
  473.       var _loc3_ = _iCurrQuestion;
  474.       trace(">CCCCCCCCCCCCCCCCCCCCCCCCCCEEEEEEEEEEEEEEE - _iCurrQuestion : " + _loc3_);
  475.       var _loc2_ = _loc1_.c_strMode == "Review";
  476.       _loc1_.fileNo = _loc3_;
  477.       _loc1_.objRef.mc_feedbackBox._visible = false;
  478.       _loc1_.c_btnShowCurrent.gotoAndStop("NORMAL");
  479.       _loc1_.showNextButton();
  480.       _loc1_.showComboSelection(_loc3_ + 1);
  481.       _loc1_.freeze(_loc2_);
  482.       _loc1_.showSCButtons(_loc2_);
  483.       _loc1_.setScrollBarPosition(_loc3_);
  484.    }
  485.    function showSCButtons(bIfReview)
  486.    {
  487.       var _loc2_ = this;
  488.       if(bIfReview)
  489.       {
  490.          _loc2_.showHideSCButtons(true);
  491.          var iTotalQuestions = _loc2_.c_arrQuesNos.length;
  492.          var _loc1_ = 1;
  493.          while(_loc1_ <= iTotalQuestions)
  494.          {
  495.             var iQuesNum = _loc2_.getQueNo(_loc1_ - 1);
  496.             var _loc3_ = _loc2_.c_objHMObj["get"](_loc2_.c_strSkill + "_" + iQuesNum);
  497.             var strCorrect = _loc3_.correct;
  498.             if(strCorrect == "1")
  499.             {
  500.                var mcShowButton = _loc2_.fib.mcSCHolder["mc_ShowButton_" + _loc1_];
  501.                mcShowButton._visible = false;
  502.             }
  503.             _loc1_ = _loc1_ + 1;
  504.          }
  505.       }
  506.    }
  507.    function arrangetext()
  508.    {
  509.       this.strText = this.strText.split("<p></p>").join(" <p></p> ");
  510.       var _loc3_ = this.strText.split("<gap type=\'dropdown\'>");
  511.       var arrData = new Array();
  512.       arrData.push(_loc3_[0]);
  513.       var _loc1_ = 1;
  514.       while(_loc1_ < _loc3_.length)
  515.       {
  516.          var _loc2_ = _loc3_[_loc1_].split("</gap>");
  517.          arrData.push(_loc2_[0]);
  518.          arrData.push(_loc2_[1]);
  519.          false;
  520.          _loc1_ = _loc1_ + 1;
  521.       }
  522.       false;
  523.       false;
  524.       return arrData;
  525.    }
  526.    function addEventToDropDown(box, objRef)
  527.    {
  528.       var _loc3_ = this;
  529.       box.objBoxCombo = new Object();
  530.       box.objBoxCombo.objRef = _loc3_;
  531.       box.onSetFocus = function()
  532.       {
  533.          box.pCustomFocus = true;
  534.          var _loc1_ = Number(box._name.split("Box")[1]);
  535.          box.objBoxCombo.objRef.showComboSelection(_loc1_ + 1);
  536.          box.objBoxCombo.objRef.showNavigationSelection(_loc1_);
  537.       };
  538.       box.objBoxCombo.change = function(evt)
  539.       {
  540.          var _loc1_ = box.getSelectedIndex();
  541.          this.objRef.onComboChanged(box,this.objRef,_loc1_);
  542.          box.pCustomFocus = false;
  543.       };
  544.       box.setChangeHandler("change",box.objBoxCombo);
  545.    }
  546.    function freeze(_blnFreeze)
  547.    {
  548.       var _loc2_ = this;
  549.       var _loc3_ = _blnFreeze;
  550.       var _loc1_ = 0;
  551.       while(_loc1_ < _loc2_.c_arrQuesNos.length)
  552.       {
  553.          _loc2_.fib["Box" + _loc1_].enabled = !_loc3_;
  554.          _loc1_ = _loc1_ + 1;
  555.       }
  556.    }
  557.    function showComboSelection(iBoxNumber)
  558.    {
  559.       this.deselectAllCombo();
  560.       this.fib.mcSelectionClipHolder["mcSelectionRect_" + iBoxNumber].gotoAndStop("_SELECT");
  561.    }
  562.    function deselectAllCombo()
  563.    {
  564.       var _loc3_ = this;
  565.       var _loc2_ = _loc3_.c_arrQuesNos.length;
  566.       var _loc1_ = 1;
  567.       while(_loc1_ <= _loc2_)
  568.       {
  569.          _loc3_.fib.mcSelectionClipHolder["mcSelectionRect_" + _loc1_].gotoAndStop("_DESELECT");
  570.          _loc1_ = _loc1_ + 1;
  571.       }
  572.    }
  573.    function showNavigationSelection(iBoxNumber)
  574.    {
  575.       var _loc1_ = this;
  576.       _loc1_.fileNo = iBoxNumber;
  577.       _loc1_.c_objNavRef.c_iSeleID = _loc1_.c_arrQuesNos[iBoxNumber];
  578.       _loc1_.c_objNavRef.c_preSelecetd = _loc1_.c_objNavRef.c_strSelecetd;
  579.       _loc1_.c_objNavRef.c_strSelecetd = "_" + _loc1_.c_iGroup + "_" + _loc1_.fileNo;
  580.       _loc1_.c_objNavRef.navClickedfunction();
  581.    }
  582.    function onComboChanged(box, objRef, iSelectedIndex)
  583.    {
  584.       var _loc1_ = this;
  585.       if(box.pCustomFocus)
  586.       {
  587.          trace(">%%%%%%%%%%%%%%%%%%%%%%% CCFFFFFFFFf");
  588.          var objHMCurrentQues = new Object();
  589.          var iBoxID = Number(box._name.split("Box")[1]);
  590.          var arrCorrectAns = box.strCorrectAnswer.split("|");
  591.          var strPaired = _loc1_.c_objSection.question[iBoxID].attributes.paired;
  592.          var bCurrentCorrect = _loc1_.isCorrect(arrCorrectAns,iSelectedIndex + 1);
  593.          var bIsPairMatching = true;
  594.          if(strPaired != undefined && strPaired != null)
  595.          {
  596.             var _loc3_ = new Object();
  597.             var iPairedBoxID = _loc1_.getComboNo(Number(strPaired));
  598.             var _loc2_ = _loc1_.fib["Box" + iPairedBoxID].getSelectedIndex();
  599.             trace(">>^^^^^^^^^^^^^^ - iPairSelected : " + _loc2_);
  600.             if(_loc2_ != undefined && _loc2_ != null)
  601.             {
  602.                var bPairedCorrect = _loc1_.isCorrect(arrCorrectAns,_loc2_ + 1);
  603.                bIsPairMatching = _loc1_.isAnsMatching(_loc2_,iSelectedIndex);
  604.                trace("PPPPPPRRRRRRRRRR############### - bIsPairMatching : " + bIsPairMatching);
  605.             }
  606.             if(bPairedCorrect && !bIsPairMatching)
  607.             {
  608.                _loc3_.correct = 1;
  609.             }
  610.             else
  611.             {
  612.                _loc3_.correct = 0;
  613.             }
  614.             _loc3_.attempted = _loc2_;
  615.             _loc1_.c_objNavRef.c_objTestRef.c_strCurrSelected = iPairedBoxID;
  616.             _loc1_.c_objNavRef.c_objTestRef.c_iCurrQuestion = _loc1_.c_objSection.question[iPairedBoxID].attributes.number;
  617.             _loc1_.c_objNavRef.c_objTestRef.appendQuesObject(_loc3_);
  618.          }
  619.          objHMCurrentQues.correct = !bCurrentCorrect ? 0 : 1;
  620.          objHMCurrentQues.attempted = iSelectedIndex;
  621.          _loc1_.c_objNavRef.c_objTestRef.c_strCurrSelected = iBoxID;
  622.          _loc1_.c_objNavRef.c_objTestRef.c_iCurrQuestion = _loc1_.c_objSection.question[iBoxID].attributes.number;
  623.          box.answered = "yes";
  624.          _loc1_.c_objNavRef.markAttempted();
  625.          _loc1_.c_objNavRef.c_objTestRef.appendQuesObject(objHMCurrentQues);
  626.          _loc1_.showNextButton();
  627.       }
  628.    }
  629.    function isCorrect(arrCorrectAns, iCurrentSelected)
  630.    {
  631.       var _loc3_ = arrCorrectAns.length;
  632.       var _loc2_ = false;
  633.       var _loc1_ = 0;
  634.       while(_loc1_ < _loc3_)
  635.       {
  636.          if(iCurrentSelected == Number(arrCorrectAns[_loc1_]))
  637.          {
  638.             _loc2_ = true;
  639.             break;
  640.          }
  641.          _loc2_ = false;
  642.          _loc1_ = _loc1_ + 1;
  643.       }
  644.       return _loc2_;
  645.    }
  646.    function isAnsMatching(iCurrentSelected, iPairedSelected)
  647.    {
  648.       return iCurrentSelected == iPairedSelected;
  649.    }
  650.    function showCurrectAnswer(iComboID, _bln)
  651.    {
  652.       var strCorrectAnswer = this.getCorrectAnswer(iComboID);
  653.       var iQuesNo = this.getQueNo(iComboID);
  654.       trace("strCorrectAnswer :" + strCorrectAnswer);
  655.       this.c_btnShowPrevious.gotoAndStop("NORMAL");
  656.       this.c_btnShowPrevious.enabled = true;
  657.       this.c_btnShowCurrent.gotoAndStop("CLICKED");
  658.       this.c_btnShowCurrent.enabled = false;
  659.       var _loc2_ = this.objRef.mc_feedbackBox;
  660.       if(_bln)
  661.       {
  662.          _loc2_._visible = true;
  663.          _loc2_.btn_close.enabled = true;
  664.          _loc2_.btn_close.objRef = this;
  665.          _loc2_.btn_close.onRelease = function()
  666.          {
  667.             var _loc1_ = this;
  668.             _loc1_.objRef.c_btnShowCurrent.gotoAndStop("NORMAL");
  669.             _loc1_.objRef.c_btnShowCurrent.enabled = true;
  670.             _loc1_.enabled = false;
  671.             _loc1_._parent._visible = false;
  672.             _loc1_._parent.txt_header.text = "";
  673.             _loc1_._parent.txt_options.text = "";
  674.          };
  675.          _loc2_.swapDepths(100);
  676.          _loc2_.mc_resizableBox.useHandCursor = false;
  677.          _loc2_.mc_resizableBox.onPress = function()
  678.          {
  679.             this._parent.startDrag(false,-55,12,324,255);
  680.          };
  681.          _loc2_.mc_resizableBox.onRelease = _loc2_.mc_resizableBox.onReleaseOutside = function()
  682.          {
  683.             stopDrag();
  684.          };
  685.          var objRB = new com.comp.ResizableBox();
  686.          objRB.resizeBox(370,80,_loc2_.mc_resizableBox);
  687.          var revTxt = this.objRef.mc_resizableBox;
  688.          _loc2_.txt_header.text = "Correct Answer(s) for Question No. " + iQuesNo;
  689.          _loc2_.txt_header.autoSize = "left";
  690.          _loc2_.txt_options.text = "";
  691.          var _loc3_ = strCorrectAnswer.split("|");
  692.          var _loc1_ = 0;
  693.          while(_loc1_ < _loc3_.length)
  694.          {
  695.             _loc2_.txt_options.text += String.fromCharCode(64 + Number(_loc3_[_loc1_]));
  696.             if(!(_loc1_ % 2) && _loc3_.length > 1)
  697.             {
  698.                _loc2_.txt_options.text += " or ";
  699.             }
  700.             _loc1_ = _loc1_ + 1;
  701.          }
  702.          _loc2_.txt_options.autoSize = "left";
  703.       }
  704.       else
  705.       {
  706.          _loc2_._visible = false;
  707.       }
  708.    }
  709.    function showNextButton()
  710.    {
  711.       var _loc2_ = this;
  712.       if(_loc2_.c_objNavRef.c_objTestRef.c_objScreenData.DOC.section.length - 1 != _loc2_.c_objNavRef.c_objTestRef.c_iPartNo)
  713.       {
  714.          if(_loc2_.c_strMode == "Review")
  715.          {
  716.             _loc2_.objRef.btn_next._visible = true;
  717.          }
  718.          else
  719.          {
  720.             var _loc1_ = 0;
  721.             while(_loc1_ < _loc2_.c_arrQuesNos.length)
  722.             {
  723.                _loc2_.objRef.btn_next._visible = true;
  724.                if(_loc2_.fib["Box" + _loc1_].answered == "no")
  725.                {
  726.                   _loc2_.objRef.btn_next._visible = false;
  727.                   break;
  728.                }
  729.                _loc1_ = _loc1_ + 1;
  730.             }
  731.          }
  732.       }
  733.    }
  734.    function getCorrectAnswer(iComboNo)
  735.    {
  736.       var _loc2_ = this.c_objSection.question;
  737.       var queLength = _loc2_.length;
  738.       var _loc1_ = 0;
  739.       while(_loc1_ <= queLength)
  740.       {
  741.          if(_loc2_[_loc1_] == _loc2_[iComboNo])
  742.          {
  743.             var _loc3_ = _loc2_[_loc1_].attributes.correct;
  744.             return _loc3_;
  745.          }
  746.          _loc1_ = _loc1_ + 1;
  747.       }
  748.    }
  749.    function getQueNo(iComboNo)
  750.    {
  751.       var _loc2_ = this.c_objSection.question;
  752.       var _loc1_ = 0;
  753.       while(_loc1_ <= _loc2_.length)
  754.       {
  755.          if(_loc2_[_loc1_] == _loc2_[iComboNo])
  756.          {
  757.             var _loc3_ = _loc2_[_loc1_].attributes.number;
  758.             return _loc3_;
  759.          }
  760.          _loc1_ = _loc1_ + 1;
  761.       }
  762.    }
  763.    function getComboNo(iQueNo)
  764.    {
  765.       var _loc3_ = iQueNo;
  766.       var _loc2_ = this.c_objSection.question;
  767.       var _loc1_ = 0;
  768.       while(_loc1_ <= _loc2_.length)
  769.       {
  770.          if(_loc2_[_loc1_].attributes.number == _loc3_)
  771.          {
  772.             return _loc1_;
  773.          }
  774.          _loc1_ = _loc1_ + 1;
  775.       }
  776.    }
  777. }
  778.