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

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