Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Action script...
  2.  
  3. // [onClipEvent of sprite 65 in frame 15]
  4. onClipEvent (load)
  5. {
  6.     setProperty("", _visible, false);
  7. }
  8.  
  9. // [onClipEvent of sprite 65 in frame 15]
  10. onClipEvent (load)
  11. {
  12.     setProperty("", _visible, false);
  13. }
  14.  
  15. // [onClipEvent of sprite 126 in frame 15]
  16. onClipEvent (load)
  17. {
  18.     setProperty("", _visible, false);
  19. }
  20.  
  21. // [Action in Frame 1]
  22. testName = "Trigonometry - missing angles";
  23. testID = 1131;
  24.  
  25. useCalc = true;
  26.  
  27. function showanswers(numstart, numboxes, questionnum, mymaths, tidyup)
  28. {
  29.     theAnswers = new Array();
  30.     for (i = numstart; i <= numboxes; i++)
  31.     {
  32.         if (questionnum == 1)
  33.         {
  34.             theAnswers[i] = q1answers[i];
  35.         } // end if
  36.         if (questionnum == 2)
  37.         {
  38.             theAnswers[i] = q2answers[i];
  39.         } // end if
  40.     } // end of for
  41.     ansMovie = eval("q" + questionnum + "ansmov");
  42.     for (i = numstart; i <= numboxes; i++)
  43.     {
  44.         obj = eval("box" + i);
  45.         wid = obj._width;
  46.         ht = obj._height;
  47.         x = obj._x;
  48.         y = obj._y + ht / 1.500000E+000;
  49.         an = obj.text;
  50.         showThis = true;
  51.         an = roundit(obj.text);
  52.         if (an == "")
  53.         {
  54.             obj.text = " ";
  55.             showThis = false;
  56.         } // end if
  57.         answer = "answer" + i;
  58.         obj2 = eval("box" + (i + 1));
  59.         xgap = Math.abs(obj2._x - obj._x);
  60.         ygap = obj2._y - obj._y;
  61.         ans = theAnswers[i];
  62.         fraction = false;
  63.         if (ygap <= ht && ygap > 0 && xgap < wid)
  64.         {
  65.             fraction = true;
  66.             x = obj._x + wid;
  67.             y = obj._y;
  68.             ht = ht * 2;
  69.             temp = String(theAnswers[i + 1]);
  70.             linelength = temp.length;
  71.             an = an / obj2.text;
  72.             cancelDown(theAnswers[i], theAnswers[i + 1]);
  73.             ans = showFracVals[0] / showFracVals[1];
  74.             theAnswers[i] = showFracVals[0] + "\n" + showFracVals[1];
  75.             theAnswers[i + 1] = "";
  76.         } // end if
  77.         if (an != ans && ShowThis)
  78.         {
  79.             ansMovie.createTextField(answer, i, x, y, wid, ht);
  80.             answer = eval(ansMovie + ".answer" + i);
  81.             answer.text = theAnswers[i];
  82.             if (fraction)
  83.             {
  84.                 line = "line" + i;
  85.                 ansMovie.createEmptyMovieClip(line, 100 + i);
  86.                 obj = eval(ansMovie + "." + line);
  87.                 lineLength = linelength * 5;
  88.                 with (obj)
  89.                 {
  90.                     lineStyle(2, 10066380, 100);
  91.                     moveTo(x + wid / 2 - lineLength, y + ht / 2.200000E+000);
  92.                     lineTo(x + wid / 2 + lineLength, y + ht / 2.200000E+000);
  93.                 } // End of with
  94.             } // end if
  95.             answer.multiline = true;
  96.             answer.wordWrap = true;
  97.             answer.border = false;
  98.             myformat = new TextFormat();
  99.             objFormat = obj.getTextFormat();
  100.             myformat.color = 10066380;
  101.             if (objFormat.font == null)
  102.             {
  103.                 myformat.font = "Verdana";
  104.                 myformat.size = 16;
  105.                 myformat.align = "center";
  106.             }
  107.             else
  108.             {
  109.                 myformat.font = objFormat.font;
  110.                 myformat.size = objFormat.size;
  111.                 myformat.align = objFormat.align;
  112.             } // end else if
  113.             answer.embedFonts = true;
  114.             answer.selectable = false;
  115.             answer.setTextFormat(myformat);
  116.         } // end if
  117.     } // end of for
  118. } // End of the function
  119. function cancelDown(a, b)
  120. {
  121.     for (j = 0; j < div.length; j++)
  122.     {
  123.         fac = div[j];
  124.         if (Math.round(a / fac) == a / fac && Math.round(b / fac) == b / fac)
  125.         {
  126.             a = a / fac;
  127.             b = b / fac;
  128.             --j;
  129.         } // end if
  130.     } // end of for
  131.     showFracVals = new Array(a, b);
  132. } // End of the function
  133. div = new Array(2, 3, 5, 7, 11, 13, 17, 19, 23);
  134.  
  135. function roundit(txt)
  136. {
  137.     if (isNaN(txt))
  138.     {
  139.         l = txt.length;
  140.         txt = txt.toLowerCase();
  141.         for (iCount = 0; iCount <= l; iCount++)
  142.         {
  143.             if (txt.charAt(iCount) == "\"")
  144.             {
  145.                 txt = txt.substr(0, iCount) + "@" + txt.substr(iCount + 1, l);
  146.             } // end if
  147.         } // end of for
  148.         l = txt.length;
  149.         for (iCount = 0; iCount <= l; iCount++)
  150.         {
  151.             if (txt.charAt(iCount) == " ")
  152.             {
  153.                 txt = txt.substr(0, iCount) + "" + txt.substr(iCount + 1, l);
  154.                 --iCount;
  155.                 --l;
  156.             } // end if
  157.         } // end of for
  158.         txt = String(txt.toLowerCase());
  159.     }
  160.     else
  161.     {
  162.         txt = Math.round(1000 * txt) / 1000;
  163.     } // end else if
  164.     return (txt);
  165. } // End of the function
  166. function despace(txt)
  167. {
  168.     txt = roundit(txt);
  169.     return (txt);
  170. } // End of the function
  171.  
  172. function inputbox(v)
  173. {
  174.     for (i = 1; i <= v; i++)
  175.     {
  176.         obj = eval("box" + i);
  177.         obj.tabIndex = i;
  178.         obj.type = "input";
  179.         obj.selectable = true;
  180.         obj.textColor = "0x660000";
  181.         obj.borderColor = "0xcccccc";
  182.     } // end of for
  183. } // End of the function
  184. function dynamicbox(v)
  185. {
  186.     for (i = 1; i <= v; i++)
  187.     {
  188.         obj = eval("box" + i);
  189.         obj.type = "dynamic";
  190.         obj.selectable = false;
  191.         obj.textColor = "0x000000";
  192.         obj.border = false;
  193.     } // end of for
  194. } // End of the function
  195. function common(p, q, r)
  196. {
  197.     flag = false;
  198.     for (i = 0; i < div.length; i++)
  199.     {
  200.         fac = div[i];
  201.         if (rnd(p, fac) && rnd(q, fac) && rnd(r, fac))
  202.         {
  203.             flag = true;
  204.             break;
  205.         } // end if
  206.     } // end of for
  207.     if (flag)
  208.     {
  209.         return (true);
  210.     }
  211.     else
  212.     {
  213.         return (false);
  214.     } // end else if
  215. } // End of the function
  216. function rnd(val, fact)
  217. {
  218.     if (Math.round(val / fact) == val / fact)
  219.     {
  220.         return (true);
  221.     }
  222.     else
  223.     {
  224.         return (false);
  225.     } // end else if
  226. } // End of the function
  227. function markit(an1, an2, ansa, ansb, tic1, tic2)
  228. {
  229.     thisscore = 0;
  230.     tic1._visible = false;
  231.     tic2._visible = false;
  232.     an1 = roundit(an1);
  233.     an2 = roundit(an2);
  234.     if (an1 == ansa && an2 == ansb || an2 == ansa && an1 == ansb)
  235.     {
  236.         tic1._visible = true;
  237.         tic2._visible = true;
  238.         thisscore = thisscore + 2;
  239.     }
  240.     else if (an1 == ansa && an2 != ansa || an1 == ansb && an2 != ansb)
  241.     {
  242.         tic1._visible = true;
  243.         ++thisscore;
  244.     }
  245.     else if (an2 == ansa && an1 != ansa || an2 == ansb && an1 != ansb)
  246.     {
  247.         tic2._visible = true;
  248.         ++thisscore;
  249.     } // end else if
  250.     return (thisscore);
  251. } // End of the function
  252. function markit2(an1, an2, ansa1, ansa2, ansb1, ansb2, tic1, tic2)
  253. {
  254.     score = 0;
  255.     tic1._visible = false;
  256.     tic2._visible = false;
  257.     if (an1 != "" && an2 != "")
  258.     {
  259.         an1 = roundit(an1);
  260.         an2 = roundit(an2);
  261.         if (an1 >= ansa1 && an1 <= ansa2 && (an2 >= ansb1 && an2 <= ansb2) || an2 >= ansa1 && an2 <= ansa2 && (an1 >= ansb1 && an1 <= ansb2))
  262.         {
  263.             tic1._visible = true;
  264.             tic2._visible = true;
  265.             score = score + 2;
  266.         }
  267.         else if (an1 >= ansa1 && an1 <= ansa2 && !(an2 >= ansa1 && an2 <= ansa2) || an1 >= ansb1 && an1 <= ansb2 && !(an2 >= ansb1 && an2 <= ansb2))
  268.         {
  269.             tic1._visible = true;
  270.             ++score;
  271.         }
  272.         else if (an2 >= ansa1 && an2 <= ansa2 && !(an1 >= ansa1 && an1 <= ansa2) || !(an2 >= ansb1 && an2 <= ansb2) && !(an1 >= ansb1 && an1 <= ansb2))
  273.         {
  274.             tic2._visible = true;
  275.             ++score;
  276.         } // end else if
  277.         return (score);
  278.     } // end if
  279. } // End of the function
  280. rad = 5.729578E+001;
  281. now = new Date();
  282. year = now.getFullYear();
  283. yearnum = year - 2000;
  284. thisDay = now.getDate();
  285. testStamp = Number(testID) + Number(thisDay);
  286. testStamp = Math.pow(testStamp, 3) + testStamp;
  287. div = new Array(2, 3, 5, 7, 9, 11, 13, 17, 19, 23, 29);
  288.  
  289. function repeatSave()
  290. {
  291.     sCode = authCode * testID;
  292.     sCode = sCode + q1score * 100 + Number(q2score);
  293.     sCode = sCode * 10000;
  294.     sCode = sCode + testID * testID;
  295.     urls = "../../studentRecords/saveDataOH.asp?sCode=" + sCode + "&q1score=" + q1score + "&q2score=" + q2score + "&taskID=" + testID;
  296.     loadVariablesNum(urls, 0);
  297. } // End of the function
  298. function loadLogin()
  299. {
  300.     gCode = authCode * testID * testID + Number(username);
  301.     urls = "../../studentRecords/getDataOH.asp?gCode=" + gCode + "&xlogin=" + username + "&xpass=" + xpass + "&taskID=" + testID;
  302.     loadVariablesNum(urls, 0);
  303. } // End of the function
  304. function save()
  305. {
  306.     total = Number(q1marks) + Number(q2marks);
  307.     totscore = Number(q1score) + Number(q2score);
  308.     if (q1marked && q2marked && !saved)
  309.     {
  310.         co._visible = true;
  311.         coRem.play();
  312.         perc = Math.round(totscore / total * 100);
  313.         score = perc + "%";
  314.         if (studentLogged)
  315.         {
  316.             if (perc >= percentage)
  317.             {
  318.                 newrecord = true;
  319.                 newperc = perc;
  320.                 percentage = perc;
  321.             }
  322.             else
  323.             {
  324.                 newrecord = false;
  325.                 newperc = percentage;
  326.             } // end else if
  327.             repeatSave();
  328.             saved = true;
  329.         } // end if
  330.     } // end if
  331. } // End of the function
  332.  
  333. stop ();
  334.  
  335. // [Action in Frame 2]
  336. gotoAndStop(1);
  337.  
  338. // [Action in Frame 4]
  339. stop ();
  340. username = xpass = login = "";
  341. box1.tabIndex = 1;
  342. box2.tabIndex = 2;
  343. Selection.setFocus(box1);
  344. studentLogged = false;
  345. if (useCalc)
  346. {
  347.     calcComment._visible = false;
  348. } // end if
  349.  
  350. // [Action in Frame 5]
  351. stop ();
  352. this.onEnterFrame = function ()
  353. {
  354.     if (login == 2)
  355.     {
  356.         failed._visible = true;
  357.         gotoAndStop(4);
  358.     } // end if
  359.     if (login == 1)
  360.     {
  361.         gotoAndPlay(8);
  362.     } // end if
  363. };
  364.  
  365. // [Action in Frame 6]
  366. gotoAndPlay(5);
  367.  
  368. // [Action in Frame 8]
  369. details = ".: " + school + " | " + student + " :.";
  370. studentLogged = true;
  371. this.onEnterFrame = function ()
  372. {
  373. };
  374. gotoAndStop(10);
  375.  
  376. // [Action in Frame 10]
  377. q1title = "Simple triangles";
  378. q1marks = 12;
  379. q1in1 = q1in2 = q1in3 = q1in4 = q1in5 = q1in6 = q1in7 = q1in8 = "";
  380. q1text1 = q1text2 = q1text3 = q1text4 = q1text5 = q1text6 = q1text7 = q1text8 = "";
  381. q1an1 = q1an2 = q1an3 = q1an4 = q1an5 = q1an6 = q1an7 = q1an8 = "";
  382. q1v1 = 2 + random(4);
  383. q1v2 = 2 + random(6);
  384. q1v3 = 2 + random(9);
  385. q1v4 = 3 + random(5) + (1 + random(9)) / 10;
  386. q1v5 = 3 + random(5) + (1 + random(9)) / 10;
  387. q1v6 = 3 + random(5) + (1 + random(9)) / 10;
  388. q1v1a = q1v1 + 1 + random(2);
  389. q1v2a = q1v2 * 2 + random(3);
  390. q1v3a = q1v3 * 2 - 1;
  391. q1v4a = q1v4 + 1 + (1 + random(9)) / 10;
  392. q1v5a = q1v5 + 1 + (1 + random(9)) / 10;
  393. q1v6a = q1v6 + (1 + random(9)) / 10;
  394. q1text1 = q1v1 + "cm";
  395. q1text2 = q1v2 + "cm";
  396. q1text3 = q1v3 + "cm";
  397. q1text4 = q1v4 + "cm";
  398. q1text5 = q1v5 + "cm";
  399. q1text6 = q1v6 + "cm";
  400. q1text1a = q1v1a + "cm";
  401. q1text2a = q1v2a + "cm";
  402. q1text3a = q1v3a + "cm";
  403. q1text4a = q1v4a + "cm";
  404. q1text5a = q1v5a + "cm";
  405. q1text6a = q1v6a + "cm";
  406. q1ans1 = 180 * Math.asin(q1v1 / q1v1a) / 3.141593E+000;
  407. q1ans2 = 180 * Math.atan(q1v2 / q1v2a) / 3.141593E+000;
  408. q1ans3 = 180 * Math.acos(q1v3 / q1v3a) / 3.141593E+000;
  409. q1ans4 = 180 * Math.acos(q1v4 / q1v4a) / 3.141593E+000;
  410. q1ans5 = 180 * Math.asin(q1v5 / q1v5a) / 3.141593E+000;
  411. q1ans6 = 180 * Math.atan(q1v6 / q1v6a) / 3.141593E+000;
  412. q1ans1 = roundit(Math.round(q1ans1));
  413. q1ans2 = roundit(Math.round(q1ans2));
  414. q1ans3 = roundit(Math.round(q1ans3));
  415. q1ans4 = roundit(Math.round(q1ans4));
  416. q1ans5 = roundit(Math.round(q1ans5));
  417. q1ans6 = roundit(Math.round(q1ans6));
  418. q1answers = new Array(0, q1ans1, q1ans2, q1ans3, q1ans4, q1ans5, q1ans6, q1ans7, q1ans8);
  419.  
  420. q2title = "Harder questions";
  421. q2marks = 9;
  422. q2in1 = q2in2 = q2in3 = q2in4 = q2in5 = q2in6 = q2in7 = q2in8 = "";
  423. q2text1 = q2text2 = q2text3 = q2text4 = q2text5 = q2text6 = q2text7 = q2text8 = "";
  424. q2v1 = q2v2 = q2v3 = q2v4 = q2v5 = q2v6 = q2v7 = q2v8 = "";
  425. q2an1 = q2an2 = q2an3 = q2an4 = q2an5 = q2an6 = q2an7 = q2an8 = "";
  426. q2v1 = 9 + random(6);
  427. q2v1a = q2v1 - 2 - random(3);
  428. q2v2 = 15 + random(5);
  429. q2v2a = q2v2 - 3 - random(3);
  430. q2v3 = 20 + random(10);
  431. q2v3a = q2v3 - 7 - random(3);
  432. q2text1 = q2v1 + "cm";
  433. q2text1a = q2v1a + "cm";
  434. q2text2 = q2v2 + "cm";
  435. q2text2a = q2v2a + "cm";
  436. q2text3 = q2v3 + "cm";
  437. q2text3a = "BC = " + q2v3a + "cm.";
  438. q2k = 5.729578E+001;
  439. q2ans1 = q2k * Math.acos(q2v1a / (2 * q2v1));
  440. q2ans1 = roundit(Math.round(q2ans1));
  441. q2ans2 = q2k * 2 * Math.atan(q2v2a / q2v2);
  442. q2ans2 = roundit(Math.round(q2ans2));
  443. q2ans3a = q2k * Math.atan(q2v3a / q2v3);
  444. q2ans3b = q2k * Math.atan(q2v3a / (2 * q2v3));
  445. q2ans3 = q2ans3a - q2ans3b;
  446. q2ans3 = roundit(Math.round(q2ans3));
  447. q2answers = new Array(0, q2ans1, q2ans2, q2ans3, q2ans4, q2ans5, q2ans6, q2ans7, q2ans8);
  448.  
  449. stop ();
  450. q1score = q2score = 0;
  451. totscore = "";
  452. total = q1marks + q2marks;
  453. q1grade = q2grade = q1marked = q2marked = saved = false;
  454. gotoAndStop(15);
  455.  
  456. // [Action in Frame 15]
  457. q1button.onRelease = function ()
  458. {
  459.     gotoAndStop(15);
  460. };
  461. q2button.onRelease = function ()
  462. {
  463.     gotoAndStop(19);
  464. };
  465. q1button.onRollOver = function ()
  466. {
  467.     if (!q1active)
  468.     {
  469.         q1button.gotoAndStop(2);
  470.     } // end if
  471. };
  472. q1button.onRollOut = function ()
  473. {
  474.     if (!q1active)
  475.     {
  476.         q1button.gotoAndStop(1);
  477.     } // end if
  478. };
  479. q2button.onRollOver = function ()
  480. {
  481.     if (!q2active)
  482.     {
  483.         q2button.gotoAndStop(2);
  484.     } // end if
  485. };
  486. q2button.onRollOut = function ()
  487. {
  488.     if (!q2active)
  489.     {
  490.         q2button.gotoAndStop(1);
  491.     } // end if
  492. };
  493.  
  494. if (!useCalc)
  495. {
  496.     calc.nextFrame();
  497. } // end if
  498.  
  499. q2button.gotoAndStop(1);
  500. q1button.gotoAndStop(3);
  501. unloadMovieNum(10000);
  502. q1active = true;
  503. q2active = false;
  504.  
  505. if (q1marked)
  506. {
  507.     nextFrame ();
  508. }
  509. else
  510. {
  511.     Selection.setFocus("box1");
  512.     inputbox(8);
  513. } // end else if
  514.  
  515. // [Action in Frame 16]
  516. showanswers(1, 8, 1);
  517.  
  518. q1marked = true;
  519. unloadMovieNum(10000);
  520. q1score = 0;
  521. butlab1._alpha = 40;
  522. dynamicbox(8);
  523. an = roundit(q1an1);
  524. if (an == q1ans1)
  525. {
  526.     q1score = q1score + 2;
  527.     q1t1._visible = true;
  528. } // end if
  529. an = roundit(q1an2);
  530. if (an == q1ans2)
  531. {
  532.     q1score = q1score + 2;
  533.     q1t2._visible = true;
  534. } // end if
  535. an = roundit(q1an3);
  536. if (an == q1ans3)
  537. {
  538.     q1score = q1score + 2;
  539.     q1t3._visible = true;
  540. } // end if
  541. an = roundit(q1an4);
  542. if (an == q1ans4)
  543. {
  544.     q1score = q1score + 2;
  545.     q1t4._visible = true;
  546. } // end if
  547. an = roundit(q1an5);
  548. if (an == q1ans5)
  549. {
  550.     q1score = q1score + 2;
  551.     q1t5._visible = true;
  552. } // end if
  553. an = roundit(q1an6);
  554. if (an == q1ans6)
  555. {
  556.     q1score = q1score + 2;
  557.     q1t6._visible = true;
  558. } // end if
  559. summary = "You have scored " + q1score + " out of " + q1marks + " on this question.";
  560. if (q1score == q1marks)
  561. {
  562.     q1grade = true;
  563.     q1completed._visible = true;
  564. } // end if
  565. save();
  566.  
  567. // [Action in Frame 19]
  568. q1button.gotoAndStop(1);
  569. q2button.gotoAndStop(3);
  570. unloadMovieNum(10000);
  571. q1active = false;
  572. q2active = true;
  573.  
  574. if (q2marked)
  575. {
  576.     nextFrame ();
  577. }
  578. else
  579. {
  580.     Selection.setFocus("box1");
  581.     inputbox(8);
  582. } // end else if
  583.  
  584. // [Action in Frame 20]
  585. showanswers(1, 8, 2);
  586.  
  587. q2marked = true;
  588. unloadMovieNum(10000);
  589. q2score = 0;
  590. butlab2._alpha = 40;
  591. dynamicbox(8);
  592. an = roundit(q2an1);
  593. if (an == q2ans1)
  594. {
  595.     q2score = q2score + 2;
  596.     q2t1._visible = true;
  597. }
  598. else if (an == q2ans1 + 1 || an == q2ans1 - 1)
  599. {
  600.     q2score = q2score + 1;
  601. } // end else if
  602. an = roundit(q2an2);
  603. if (an == q2ans2)
  604. {
  605.     q2score = q2score + 3;
  606.     q2t2._visible = true;
  607. }
  608. else if (an == q2ans2 + 1 || an == q2ans2 - 1)
  609. {
  610.     q2score = q2score + 2;
  611. } // end else if
  612. an = roundit(q2an3);
  613. if (an == q2ans3)
  614. {
  615.     q2score = q2score + 4;
  616.     q2t3._visible = true;
  617. }
  618. else if (an == q2ans3 + 1 || an == q2ans3 - 1)
  619. {
  620.     q2score = q2score + 3;
  621. } // end else if
  622. summary = "You have scored " + q2score + " out of " + q2marks + " on this question.";
  623. if (q2score == q2marks)
  624. {
  625.     q2grade = true;
  626.     q2completed._visible = true;
  627. } // end if
  628. save();
  629.  
  630. // [Action in Frame 23]
  631. q1todayperc = Math.round(q1score / q1marks * 100);
  632. q2todayperc = Math.round(q2score / q2marks * 100);
  633. if (q1perc >= 40)
  634. {
  635.     summtable.q1face.nextFrame();
  636. } // end if
  637. if (q1perc >= 70)
  638. {
  639.     summtable.q1face.nextFrame();
  640. } // end if
  641. if (q2perc >= 40)
  642. {
  643.     summtable.q2face.nextFrame();
  644. } // end if
  645. if (q2perc >= 70)
  646. {
  647.     summtable.q2face.nextFrame();
  648. } // end if
  649. if (percentage >= 40)
  650. {
  651.     summtable.ovface.nextFrame();
  652. } // end if
  653. if (percentage >= 70)
  654. {
  655.     summtable.ovface.nextFrame();
  656. } // end if
  657. ++attempts;
  658.  
  659. stop ();
  660.  
  661. // [Action in Frame 24]
  662. q1todayperc = Math.round(q1score / q1marks * 100);
  663. q2todayperc = Math.round(q2score / q2marks * 100);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement