13 Replies Latest reply on Jun 11, 2007 9:12 AM by stevenjs

    Flash Quiz Guru Needed:

    stevenjs
      Greeings, all,

      Here's what I need:

      Flash 8 has quiz templates which are coded for multiple choice, true/false, text statement, and matching types of questions, along with hotspots and probably anoher type I am forgetting. The test taker makes their selection(s) or answers, and clicks a "check answer" button. They then get a feedback statements depending on whether they have answered correctly or not. Many questions involve multiple selections to be correct, but all must click on the "check answer" button to advance to the next question.

      The point is that all of this functionality is coded in the component(s) which make the template so versatile. A copy of my .fla shouldn't actually be needed (I am guessing here), because the component code is what I believe needs tweaking, at least the part where the final percentage of correct answers is calculated at the end of the test, and that percentage is compared to a user-defined passing percentage score.

      I think this requires a Flash Quiz Guru, who knows just where to find the code in the component(s) and connect the pass or fail result to a new button or a "go to" redirect. I don't know enough to say the same effect could not be accomplished by frame scripting, but I expect the component(s) code would seem a more direct approach.

      I cannot fill in the blanks for any idea that is just an idea. If anyone can code this, make it work and test it, and direct me to where the snippets must be placed, I would be deeply grateful. This is about education, not a game or commercial razz-ma-tazz.

      Are there any Flash Quiz Guru's who can help me out with this?

      Thank you.

      regards,

      stevenjs
      ____________________________________
      "I am but an egg."
      --Stranger in a Strange Land
        • 1. Re: Flash Quiz Guru Needed:
          stevenjs41
          Here's a copy of the Flash 8 Quiz Component called "QuizGlobalClass" in the template library, prior to any of the quiz parameters being set in the component interface (hence some items are "undefined"):

          **************************

          #initclip 1

          /*--------------VERSION CONTROL INFORMATION----------------------

          Quiz Template Global Toolbox Class
          Developed by Dan Carr
          Quality Assurance by Andrew Chemey
          Last Modified for Flash 2004: July 6, 2003
          Copyright 2003 Macromedia Inc. All rights reserved.

          ------------------END VERSION CONTROL--------------------------
          */


          // SECTION 1: BUILD THE QUIZ CLASS FOR EVENT HANDLING

          // 1-1: Set the contructor function for the Quiz Class

          _global.Quiz = function (){

          this.total_correct = 0;
          this.total_wrong = 0;
          this.percent_correct = 0;
          this.percent_display = undefined;

          this.quest_to_ask = 0;
          this.randomize = undefined;
          this.login_file = undefined;
          this.activity_ID = undefined;
          this.activity_name = undefined;
          this.results_page = undefined;

          this.level = undefined;

          this.Quest_Frames = new Array();
          this.quest_num = 0;
          this.page_num = undefined;
          this.endFlag = false;
          }

          _global.Quiz.prototype = new Object();

          Object.registerClass("QuizSuperClass",Quiz);

          // 1-2: Initialize Quiz tracking session

          Quiz.prototype.initStartQuiz = function (){

          this.start_time = Math.round(getTimer()/1000);
          var start_param = this.login_file+";"+this.activity_ID+";"+this.activity_name;

          fscommand("CMIInitialize");
          fscommand("MM_cmiSetLessonStatus", "i");
          fscommand("MM_StartSession", start_param);
          }


          // 1-3: Initialize a new quiz page

          Quiz.prototype.initNewPage = function(num){

          fscommand("CMISetLocation", num);
          }


          // 1-4: Conclude the Quiz session and submit score

          Quiz.prototype.initSubmitScore = function(){

          this.stop_time = Math.round(getTimer()/1000);
          this.elapsed_time = this.getLatency(this.stop_time - this.start_time);
          this.percent_correct = Math.round(this.total_correct/(this.total_correct+this.total_wrong)*100);

          fscommand("MM_cmiSetLessonStatus", "c");
          fscommand("CMISetTime", this.elapsed_time);
          fscommand("CMISetScore", this.percent_correct);
          fscommand("CMIFinish");
          fscommand("CMIExitAU");
          }


          // 1-5: Format Latency for correct tracking

          Quiz.prototype.getLatency = function (timeInSec){

          var l_seconds, l_minutes, l_hours, timeInHours;

          if (timeInSec <= 9) {
          l_seconds = "0"+timeInSec;
          l_minutes = "00";
          l_hours = "00";
          } else {
          l_seconds = timeInSec;
          l_minutes = "00";
          l_hours = "00";
          }
          if (l_seconds > 59) {
          l_minutes = int(l_seconds / 60);
          l_minutes = this.formatNum(l_minutes);
          l_seconds = l_seconds - (l_minutes * 60);
          l_seconds = this.formatNum(l_seconds);
          l_hours = "00";
          }
          if (l_minutes > 59) {
          l_hours = int(l_minutes/ 60);
          l_hours = this.formatNum(l_hours);
          l_minutes = l_minutes - (l_hours * 60);
          l_minutes = this.formatNum(l_minutes);
          }
          timeInHours = l_hours+":"+l_minutes+":"+l_seconds;
          return timeInHours;
          }


          // 1-6: Return formatted number - convert from single digit to double digit

          Quiz.prototype.formatNum = function (num) {

          if (num <= 9) {
          num = "0"+num;
          }
          return num;
          }


          // 1-7: Set the pooling number and build an array of page numbers

          Quiz.prototype.setQuestArray = function(){

          this.pooling_array = new Array();
          this.start_page;
          this.end_page;

          for (var i = 0; i < _root._totalframes; i++) {
          this.pooling_array = i+1;
          }
          this.start_page = this.pooling_array.shift();
          this.end_page = this.pooling_array.pop();

          if (this.randomize == true) {
          this.setRandomArray(this.pooling_array);
          }

          if (this.quest_to_ask > this.pooling_array.length || this.quest_to_ask < 1) {
          this.quest_to_ask = this.pooling_array.length;
          } else {
          this.quest_to_ask = int(this.quest_to_ask);
          }

          for (var i = 0; i < this.quest_to_ask; i++) {
          this.Quest_Frames
          = this.pooling_array ;
          }
          }


          // 1-8: Randomize the array of page numbers if requested

          Quiz.prototype.setRandomArray = function(array){

          for (var i=0 ; i < array.length; i++) {
          newLoc = Math.round(Math.random() * (array.length-1));
          currLoc = array
          ;
          array = array[newLoc];
          array[newLoc] = currLoc;
          }
          }


          // 1-9: Set the navigation to the next page in the array

          Quiz.prototype.setNewPage = function() {

          if (this.endFlag == false){

          this.page_num = this.Quest_Frames[this.quest_num];
          this.quest_num++;

          this.initNewPage(this.page_num);
          _root.gotoAndStop(this.page_num);

          } else if (this.endFlag == true) {
          this.percent_format = this.percent_correct+"%";
          _root.gotoAndStop(_root._totalframes);
          }
          }


          // 1-10: Catch the result variables from the interactions

          Quiz.prototype.countScore = function (weightNum){

          if (weightNum < 0) {
          this.total_wrong += Math.abs(weightNum);
          } else {
          this.total_correct += Number(weightNum);
          }

          this.quest_to_ask--;

          if(this.quest_to_ask > 0){
          _root.nav.nextBtn.gotoAndStop(1);

          } else if (this.quest_to_ask == 0) {
          this.initSubmitScore();
          this.endFlag = true;

          if(this.results_page == true){
          _root.nav.nextBtn.gotoAndStop(1);
          } else {
          _root.nav.nextBtn.gotoAndStop(2);
          }
          }
          }

          #endinitclip 1
          *************************************

          Although I am guessing, it seems what's needed is a conditional statement, perhaps using "this.percent_display = undefined;" (once defined). When the percentage of correct answers is at or greater than a given passing grade percentage, the test taker is redirected to a more advanced quiz. When the percentage of correct answers is lower than passing, the test taker is invited to retake the test.

          Please, anyone?

          regards,

          stevenjs
          __________________________
          --Stranger in a Strange Land
          • 2. Re: Flash Quiz Guru Needed:
            stevenjs Level 1
            Greetings,

            Is this over or under everyone's head, or are there simply no Flash Gurus out there who are willing and able to tackle the component scripting in a Flash Quiz?

            Or is it the Spring weather?

            As you can see, I am dismayed with the lack of response to this challenge.

            In any event, let me summarize, the user experience, which should go like this:

            (1) User takes test and reaches result page
            (2) User clicks "Check Result" button
            (3) User sees grade as a percentage of corrrect answers, along with other info on template "results page."
            (4) If the grade on the results page is passing, a "next test" button appears present (along with some language of congratulations, and perhaps an instruction to print out the page to show the teacher. Don't worry about wording, I'll figure out what to say.) and opens the next test in a new window.
            or
            (5) If the grade on the results page is failing, a "retake test" button appears present along with some alternate language, the URL is the same as the existing test, refreshing the page so the test can be taken over.

            The students who will be taking this test really need hand holding, nothing can be left for them to "figure out" as far as what is happening on the page, and they need to see their score as a percentage, not just text and/or button telling them they have passed or failed. In other words, the template results fields are essential. There needs to appear a different button on the results page depending on the user's score.

            Guess it's not as simple as it seemed at first, or am I missing something? You can grab the zip at http://www.mywebniche.com/ifPassThenGoTo.zip.

            I look forward to a productive reply.

            Regards,

            stevenjs
            ____________________________
            "I am but an egg."
            • 3. Re: Flash Quiz Guru Needed:
              Level 7
              I'm not seeing the original question. How are you grading the user's
              answer? How do you know if the answer is correct? In any case, the
              number of questions is fixed. You could create a variable to hold an
              incrementing counter, or you could create an array and add the correctly
              answered question number to the array. Either one will give you a final
              count of the number of correct answers. Use the array if you care which
              questions were answered correctly.

              When the last question has been answered, divide the correct answer
              tally by the total number of questions. This is your percent correct.

              If the value is below the pass threshold, send the playback head to the
              redo frame, if the user passes, send the playback head to the pass, do
              the next quiz, frame.

              --
              Rob
              _______
              Rob Dillon
              Adobe Community Expert
              http://www.ddg-designs.com
              412-243-9119

              http://www.macromedia.com/software/trial/
              • 4. Re: Flash Quiz Guru Needed:
                stevenjs Level 1
                Hi, Rob, thanks for responding!

                Let me take your questions one at a time.

                "I'm not seeing the original question. How are you grading the user's
                answer? How do you know if the answer is correct? In any case, the
                number of questions is fixed. You could create a variable to hold an
                incrementing counter, or you could create an array and add the correctly
                answered question number to the array. Either one will give you a final
                count of the number of correct answers. Use the array if you care which
                questions were answered correctly."

                None of that is relevant. I'm speaking of a Flash Quiz Template derived test, the component code in the post is only one of several components which comprise the Actionscript of the template. Please see my example .fla at http://www.mywebniche.com/ifPassThenGoTo.zip.

                The questions are the questions, the template grades based on a percentage of correct answers out of total number of questions, the number of questions is fixed, but the component interface allows you to re-set the number of questions as you wish.

                "When the last question has been answered, divide the correct answer
                tally by the total number of questions. This is your percent correct."

                Yes, of course, and the template component does that very nicely.

                "If the value is below the pass threshold, send the playback head to the
                redo frame, if the user passes, send the playback head to the pass, do
                the next quiz, frame."

                Now you're talking turkey. Not being an object oriented programmer (OOP) of any kind, with very spotty and minimal experience with ActionScript, I cannot write the code to make that happen, least of all in the context of Flash's own component code.

                Can you write the AS to make that happen?

                regards,

                stevenjs
                _________________________
                "I am but an egg."
                --Stranger in a Strange Land

                • 5. Re: Flash Quiz Guru Needed:
                  Level 7
                  I'll have a look through your file. I'm sure that I can give you a
                  useful solution. It may take a day or two until I have time.

                  --
                  Rob
                  _______
                  Rob Dillon
                  Adobe Community Expert
                  http://www.ddg-designs.com
                  412-243-9119

                  http://www.macromedia.com/software/trial/
                  • 6. Re: Flash Quiz Guru Needed:
                    stevenjs Level 1
                    Rob, if you can, all of us here will be deeply grateful. By having this functionality added to the template, we can then "scaffold" tests/learning objects, so students progress only when they have reached a baseline and are ready to do so.

                    It's very important to us, and we really appreciate your help.

                    best regards,

                    stevenjs
                    ____________________
                    "I am but an egg."
                    • 7. Re: Flash Quiz Guru Needed:
                      Level 7
                      There is a folder buried in your Library titled "Component Super Class"
                      that contains a movieClip that holds some Actionscript. In there are
                      some functions that are labeled as "Quiz Template Global Toolbox Class".
                      One of these, "Quiz.prototype.initSubmitScore" seems to describe what
                      happens when the user finishes. Aside from displaying the user's score,
                      it calls these:
                      fscommand("MM_cmiSetLessonStatus", "c");
                      fscommand("CMISetTime", this.elapsed_time);
                      fscommand("CMISetScore", this.percent_correct);
                      fscommand("CMIFinish");
                      fscommand("CMIExitAU");

                      I'm guessing that these functions are listed in the HTML.

                      It may be that one or more of these functions is designed to do what you
                      need. In any case, it would be good to know what these functions do.

                      --
                      Rob
                      _______
                      Rob Dillon
                      Adobe Community Expert
                      http://www.ddg-designs.com
                      412-243-9119

                      http://www.macromedia.com/software/trial/
                      • 8. Re: Flash Quiz Guru Needed:
                        stevenjs Level 1
                        Hi Rob,

                        Are you waiting for a response from me on "Quiz.prototype.initSubmitScore" etc.?

                        Please let me hear from you.

                        Thanks.

                        regards,

                        Stevenjs
                        ____________________________________
                        "I am but an egg."
                        --Stranger in a Strange Land
                        • 9. Re: Flash Quiz Guru Needed:
                          Level 7
                          Yes, I asked about the many fscommand calls.

                          --
                          Rob
                          _______
                          Rob Dillon
                          Adobe Community Expert
                          http://www.ddg-designs.com
                          412-243-9119

                          http://www.macromedia.com/software/trial/
                          • 10. Re: Flash Quiz Guru Needed:
                            stevenjs Level 1
                            Rob,

                            I can no more explain them to you than the dead sea scrolls. Sorry, I am not an ActionScripter, and as noted in the original posting: "I cannot fill in the blanks for any idea that is just an idea. If anyone can code this, make it work and test it, and direct me to where the snippets must be placed, I would be deeply grateful. "

                            Yes, it does seem they are involved, though exactly how they can be manipulated, well, that's why I need a Flash Quiz Guru.

                            Can you take a stab at it?

                            regards,

                            Stevenjs
                            _________________________
                            "I am but an egg."
                            • 11. Re: Flash Quiz Guru Needed:
                              stevenjs Level 1
                              Rob,

                              I got the following advise from another forum, but it does not work. Perhaps it will provide a clue for you to take to the next level.

                              ******************************
                              Add the following code to final frame:

                              / set the number of correct answers needed to load the next test, 5 in our example
                              if (QuizTrack.total_correct>5) {
                              // message displayed when the test is passed
                              finalMessage.text = "Well done you successfully passed the test";
                              // Label of the button when the test is passed
                              checkResult.label = "Next Test";
                              checkResult.onRelease = function() {
                              unloadMovie(_root);
                              // the line below loads the new test, change the name of the swf accordingly
                              loadMovie("nextTest.swf", _root);
                              };
                              } else {
                              // message displayed when the test is not passed
                              finalMessage.text = "Please retake the the test";
                              // Label of the button when the test is not passed
                              checkResult.label = "Retake test";
                              checkResult.onRelease = function() {
                              unloadMovie(_root);
                              // the line below reload the current test, change the name of the swf accordingly
                              loadMovie("FrontDesk_LearningByExam.swf", _root);
                              };
                              }
                              ******************************

                              I've added the above code to the final frame of the frame action layer (the one with the name and date scripts) and there is no effect whatsoever. The quiz runs as if it were unchanged.

                              In order to help matters along, I've changed the name and questions in the quiz. The quiz questions now tell you what to do for them to be answered correctly, or deliberately incorrectly. The first quiz is set to show 5 questions and is called scaffold1. The second quiz is set to present 10 questions, and is called scaffold2. I have the .swf/.html posted at http://mcnydev1/training/administrat...scaffold1.html

                              Scaffold2.swf is at the same directory level as scaffold1 and its .html holder.

                              I have posted a .zip of the two .fla's with the above script added (along with the .swf's and the .html) at http://www.mywebniche.com/test/scaffoldingTests.zip.

                              Hope this helps.

                              regards,

                              Stevenjs
                              __________________________
                              --Stranger in a Strange Land
                              • 12. Re: Flash Quiz Guru Needed:
                                Level 7
                                OK, I think I have this sorted out for you. I changed the code on the
                                last frame of your movie, "scaffold1.fla".

                                1. I removed the on(release) function from the button at the bottom left.
                                2. I removed the text from the top layer of that same button. Button's
                                don't have a "label" property, so the text won't respond to the code
                                that was in the last frame.
                                3. I made two new dynamic text objects on the stage:
                                4. One is sitting on top of the lower right button, this one will show
                                the "next test" or "retake test", text.
                                5. The second shows the response line that was in the code on the last
                                frame.
                                6. I rewrote a small amount of the existing code on the last frame.

                                The way that this code is written now, you will be replacing the .swf in
                                the same window each time that you move to a new quiz.

                                Here's the edited file:

                                http://www.ddg-designs.com/downloads/quiz.zip

                                Let me know what happens.

                                --
                                Rob
                                _______
                                Rob Dillon
                                Adobe Community Expert
                                http://www.ddg-designs.com
                                412-243-9119

                                http://www.macromedia.com/software/trial/
                                • 13. Flash Quiz Guru Needed:
                                  stevenjs Level 1
                                  Rob,

                                  Please forgive my unforgivable delay in getting back to you. I've been swept up in such a tornado I have only today been able to try out your work and, on behalf of all of us at the Learning Enhancement Center, countless thanks and congratulations !

                                  You've done it, and you've done it elegantly and flawlessly.

                                  Out of all the forums where I posted this request for help, I had the least hope for a solution from the Adobe/Macromedia forum (not the greatest experience in the past), but despite several attempts by other Actionscripters elsewhere, none came through with a bona fide solution.

                                  You are indeed an "Adobe Community Expert," and thank god you're here !

                                  best regards,

                                  Stevenjs
                                  ________________________________
                                  "I am but an egg."
                                  -- Stranger in a Strange Land

                                  PS. My mistake in checking the "Question Answered" box. The question was certainly not answered by me, but answered expertly by Rob Dillon in his post prior to this one.