home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 September / PCWorld_2002-09_cd.bin / Akce / Quartet / Main / MAIN.SWF / scripts / frame_75 / DoAction.as
Text File  |  2002-08-07  |  5KB  |  152 lines

  1. function Exit()
  2. {
  3.    showWait();
  4.    SaveCurrentInteraction();
  5.    _exit = true;
  6.    putParam();
  7. }
  8. function NextPage()
  9. {
  10.    if(_PageNumber < _MaxPages)
  11.    {
  12.       GotoPage(_PageNumber + 1);
  13.    }
  14. }
  15. function PreviousPage()
  16. {
  17.    if(_PageNumber > 1)
  18.    {
  19.       GotoPage(_PageNumber - 1);
  20.    }
  21. }
  22. function SetButtons(page)
  23. {
  24.    if(page == 1)
  25.    {
  26.       "navig.previous:gotoAndStop"("disable");
  27.    }
  28.    else
  29.    {
  30.       "navig.previous:gotoAndStop"("enable");
  31.    }
  32.    if(page == _MaxPages)
  33.    {
  34.       "navig.next:gotoAndStop"("disable");
  35.    }
  36.    else
  37.    {
  38.       "navig.next:gotoAndStop"("enable");
  39.    }
  40. }
  41. function GotoPage(page_number)
  42. {
  43.    navig.sun._x = eval("navig.navig_" add page_number add "._x");
  44.    SetButtons(page_number);
  45.    if(!_FirstQuestion)
  46.    {
  47.       SaveCurrentInteraction();
  48.    }
  49.    else
  50.    {
  51.       _FirstQuestion = false;
  52.    }
  53.    var q_id = _arQuestions.getID(page_number - 1);
  54.    var b_id = _arBlocksQuestions.getBlockID(q_id);
  55.    gotoAndStop(b_id);
  56.    _PageNumber = page_number;
  57.    var b_number = _arBlocks.getNumber(b_id);
  58.    var b_type = _arBlocks.getType(b_number);
  59.    "blocks:gotoAndStop"("init");
  60.    set("blocks:image",_arBlocks.getImage(b_number));
  61.    set("blocks:item",_arBlocks.getItem(b_number));
  62.    "blocks:gotoAndStop"(b_type);
  63.    var err = "0";
  64.    "questions:gotoAndStop"("init");
  65.    var e = _arQuestions.getAnswer(page_number - 1);
  66.    if(e.nodeName == "ANSWER")
  67.    {
  68.       Q_type = e.attributes.TYPE;
  69.       Q_question_id = _arQuestions.getID(page_number - 1);
  70.       Q_name = _arQuestions.getName(page_number - 1);
  71.       Q_description = _arQuestions.getDescription(page_number - 1);
  72.       Q_tracking = _arQuestions.getTracking(page_number - 1);
  73.       Q_objective_id = _arQuestions.getOid(page_number - 1);
  74.       Q_weight = _arQuestions.getWeighting(page_number - 1);
  75.       "play:gotoAndStop"("disable");
  76.       modal_questions._visible = false;
  77.       "questions:gotoAndStop"(Q_type);
  78.       switch(q_type)
  79.       {
  80.          case "MC-1":
  81.             info_text = "info_2";
  82.             Q_size = e.attributes.SIZE;
  83.             set("questions.mMC-1:Q_description",Q_description);
  84.             set("questions.mMC-1:Q_audio",e.attributes.AUDIO);
  85.             var chid = 0;
  86.             var i = 0;
  87.             while(i < e.childNodes.length)
  88.             {
  89.                if(e.childNodes[i].nodeName == "CHOICE")
  90.                {
  91.                   set("questions.mMC-1:mc_choice_id" + chr(97 + chid),e.childNodes[i].attributes.CHOICE_ID);
  92.                   set("questions.mMC-1:mc_text" + chr(97 + chid),e.childNodes[i].firstChild.nodeValue);
  93.                   set("questions.mMC-1:mc_correct" + chr(97 + chid),e.childNodes[i].attributes.CORRECT);
  94.                   set("questions.mMC-1:mc_score" + chr(97 + chid),e.childNodes[i].attributes.SCORE);
  95.                   chid++;
  96.                }
  97.                i++;
  98.             }
  99.             break;
  100.          case "SC-1":
  101.             info_text = "info_1";
  102.             Q_size = e.attributes.SIZE;
  103.             set("questions.mSC-1:Q_description",Q_description);
  104.             set("questions.mSC-1:Q_audio",e.attributes.AUDIO);
  105.             var chid = 0;
  106.             var i = 0;
  107.             while(i < e.childNodes.length)
  108.             {
  109.                if(e.childNodes[i].nodeName == "CHOICE")
  110.                {
  111.                   set("questions.mSC-1:sc_choice_id" + chr(97 + chid),e.childNodes[i].attributes.CHOICE_ID);
  112.                   set("questions.mSC-1:sc_text" + chr(97 + chid),e.childNodes[i].firstChild.nodeValue);
  113.                   set("questions.mSC-1:sc_correct" + chr(97 + chid),e.childNodes[i].attributes.CORRECT);
  114.                   set("questions.mSC-1:sc_score" + chr(97 + chid),e.childNodes[i].attributes.SCORE);
  115.                   chid++;
  116.                }
  117.                i++;
  118.             }
  119.             break;
  120.          case "EX-1":
  121.             info_text = "info_4";
  122.             Q_size = e.attributes.SIZE;
  123.             var chid = 0;
  124.             var i = 0;
  125.             while(i < e.childNodes.length)
  126.             {
  127.                if(e.childNodes[i].nodeName == "CHOICE")
  128.                {
  129.                   set("questions.mEX_1:ex_choice_id" + chr(97 + chid),e.childNodes[i].attributes.CHOICE_ID);
  130.                   set("questions.mEX_1:ex_image" + chr(97 + chid),e.childNodes[i].attributes.IMAGE);
  131.                   set("questions.mEX_1:ex_audio" + chr(97 + chid),e.childNodes[i].attributes.AUDIO);
  132.                   chid++;
  133.                }
  134.                i++;
  135.             }
  136.       }
  137.    }
  138.    else
  139.    {
  140.       err = "1";
  141.    }
  142.    Q_starttime = int(getTimer() / 1000);
  143.    Q_stoptime = 0;
  144.    if(err != "0")
  145.    {
  146.    }
  147. }
  148. var _PageNumber = 1;
  149. var _MaxPages = 3;
  150. var _FirstQuestion = true;
  151. var _StartTime = Number(int(getTimer() / 1000));
  152.