0 Replies Latest reply on Mar 12, 2008 11:50 AM by JUICE690

    Flash Quiz Template

    JUICE690
      Hope some can help me here, I've put together a quiz using a flash pre made template (Quiz_style1) but I've come across an issue I can't seem to resolve. I'd like to edit the check boxes, change the size, colour, font etc but I don't know how.

      I'm a complete novice when it comes to action scripting but I've managed to edit them (after many hours googling) but only if I start from a new blank flash document, if I try to add the same scripting to the quiz nothing happens, no errors appear when I test the quiz it just seemingly has no effect.

      Here's the action scripting for the multiple choice (Actions : Frame : 1) could someone possibly tell me where (if anywhere!?!) amongst it I can add some scripting to alter the checkboxes style, oh and erm... what scripting I should add

      Thanks for any help (hope I'm posting this in the right section )


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

      Learning Interaction Multiple Choice Component
      Developed by Dan Carr
      Quality Assurance by Andrew Chemey
      Last Modified for Flash 2004: July 7, 2003
      Copyright 2003 Macromedia Inc. All rights reserved.

      ------------------END VERSION CONTROL--------------------------

      Section 1: Event Handling Functions

      1-1: setMCAssets() // Initialize stage graphics
      1-2: setMCCheckState() // "Reset" or "Freeze" the Checkboxes
      1-3: onMCCheck() // Handles Checkbox button events
      1-4: onMCButton() // Handles Push Button events
      1-5: evalMC() // Evaluate user selections

      Section 2: Initalize Objects and Arrays from user parameters

      Section 3: Initalize Session Tracking and Graphic States

      3-1: Initialize this session with the SessionArray
      3-2: Initialize MultipleChoice properties with the host script
      3-3: Initialize stage assets
      3-4: Hide component assets

      */


      // SECTION 1: EVENT HANDLING FUNCTIONS


      // 1-1: Set the initial state for the checkboxes and labels

      function setMCAssets(){

      var router = _parent.SessionArray[_parent.session];
      var len = router.distractor_labels.length;

      for(var i=0; i < len; i++){
      router.setComponentLabel(router.Checkboxes , router.distractor_labels);
      router.setComponentListener(router.Checkboxes , onMCCheck);
      }
      }



      // 1-2: Create event handlers to reset and freeze checkbox states

      function setMCCheckState(action){

      var router = _parent.SessionArray[_parent.session];
      var len = router.distractor_labels.length;

      if (action.toLowerCase() == "reset"){
      for(var i=0; i < len; i++){
      router.assets_path[router.Checkboxes
      ].value = false;
      router.assets_path[router.Checkboxes ].enabled = true;
      }
      } else if (action.toLowerCase() == "freeze") {
      for(var j=0; j < len; j++){
      router.assets_path[router.Checkboxes[j]].enabled = false;
      }
      }
      }



      // 1-3: Build Event Handler for the CheckBox Button Clicks

      function onMCCheck(){

      var router = _parent.SessionArray[_parent.session];
      if(!router.checkFlag || router.checkFlag == false){
      router.setComponentState(router.Assets.ControlButton, true);
      router.setFeedback(1);
      }
      }



      // 1-4: Build Event Handler for the Push Button control

      function onMCButton(){

      var router = _parent.SessionArray[_parent.session];
      if(router.buttonFlag == false){

      router.checkFlag = true;
      setMCCheckState("freeze");
      evalMC();
      var result = (router.result == "C") ? 2 : 3;
      router.setFeedback(result);
      }

      if(router.result == "C"){

      if(!router.scoreFlag || router.scoreFlag == false){
      router.sessionStop();
      router.submitScore();
      router.scoreFlag = true;
      }
      router.setNavigation();

      }else if (router.result == "W"){

      if(router.numOfTries > 1){
      if (!router.resetFlag || router.resetFlag == false){
      router.buttonFlag = true;
      router.resetFlag = true;
      router.setComponentLabel(router.Assets.ControlButton, router.buttonLabels[4]);
      } else {
      router.numOfTries--;
      router.setFeedback(0);
      setMCCheckState("reset");
      router.buttonFlag = false;
      router.resetFlag = false;
      router.checkFlag = false;
      router.setComponentLabel(router.Assets.ControlButton, router.label_state);
      }
      } else {
      if(!router.scoreFlag || router.scoreFlag == false){
      router.sessionStop();
      router.submitScore();
      router.scoreFlag = true;
      }
      router.setNavigation();
      }
      }
      }



      // 1-5: Build Event Handler for Multiple Choice evaluation

      function evalMC(){

      var router = _parent.SessionArray[_parent.session];
      var len = router.distractor_labels.length;
      var answer_key = new Array();
      var selection_key = new Array();
      var response_format = new Array("a","b","c","d","e","f","g","h","i","j","k","l");
      var answer_format = new Array();
      var student_format = new Array();
      var possible = 0;
      var matched = 0;
      var incorrect = 0;
      var totalChecked = 0;
      var i=0,j=0,n=0;

      for(i=0; i < len; i++){

      if(router.response_array
      == true) possible++;

      selection_key = router.assets_path[router.Checkboxes].value; // does value work?

      if(selection_key == true) totalChecked++;

      if(router.response_array
      == true && selection_key == true){
      matched++;
      }
      else if (router.response_array
      != selection_key ){
      incorrect = true;
      }

      if (router.response_array
      == true){
      answer_format[j] = response_format ;
      j++;
      }

      if (selection_key
      == true){
      student_format[n] = response_format ;
      n++;
      }
      }

      if (answer_format.length > 1) {
      router.correct_response = "{"+answer_format.toString()+"}";
      } else {
      router.correct_response = answer_format.toString();
      }

      if (student_format.length > 1) {
      router.student_response = "{"+student_format.toString()+"}";
      } else {
      router.student_response = student_format.toString();
      }

      if(totalChecked <= possible){
      if (possible == matched){
      router.result = "C";
      } else {
      router.result = "W"
      }
      } else {
      router.result = "W"
      }
      }


      // SECTION 2: INITIALIZE OBJECTS AND ARRAYS FROM USER PARAMETERS

      Correct_Response = new Array();
      Distractor_Labels = new Array();
      Checkboxes = new Array();

      var z=0;

      for(var j=0; j < 8; j++){

      if(this["checkName"+(j+1)] != ""){

      Checkboxes[z] = this["checkName"+(j+1)];
      Distractor_Labels[z] = this["Distractor_Label"+(j+1)];
      Correct_Response[z] = toBoolean( this["Correct_Response"+(j+1)] );

      if( _parent[Checkboxes[z]] ){
      _parent[Checkboxes[z]].enabled = true;
      z++;
      }
      }
      }

      function toBoolean( str ){
      if(typeof(str) == "boolean"){
      return str;
      }else if(str.toLowerCase() == "true"){
      return true;
      }else{
      return false;
      }
      }

      Feedback_List = new Array();
      Feedback_List[0] = Initial_Feedback;
      Feedback_List[1] = Correct_Feedback;
      Feedback_List[2] = Incorrect_Feedback;
      Feedback_List[3] = Evaluate_Feedback;
      Feedback_List[4] = Tries_Feedback;

      Assets = new Object();
      Assets.QuestionField = Assets1;
      Assets.FeedbackField = Assets2;
      Assets.ControlButton= Assets3;

      ButtonLabels = new Array();
      ButtonLabels[0] = undefined;
      ButtonLabels[1] = ButtonLabels1;
      ButtonLabels[2] = ButtonLabels2;
      ButtonLabels[3] = ButtonLabels3;
      ButtonLabels[4] = ButtonLabels4;

      if(toBoolean( Feedback ) == false || typeof(Number(Num_Of_Tries)) != "number"){
      Num_Of_Tries = 1;
      }


      // SECTION 3: INITIALIZE SESSION TRACKING AND GRAPHIC STATES


      /* 3-1: Create a SessionArray to hold this session instance.
      If the SessionArray already exists, then add this
      session instance to a new index.
      */

      if(!_parent.SessionArray){
      _parent.session = 0;
      _parent.SessionArray = new Array();
      } else {
      _parent.session++;
      }

      _parent.SessionArray[_parent.session] = new LToolBox();

      var router = _parent.SessionArray[_parent.session];

      // 3-2: Initialize DragDrop properties with the host script

      router.assets_path = eval(this._parent);
      router.Checkboxes = Checkboxes;
      router.Assets = Assets;

      router.interaction_id = Interaction_ID;
      router.interaction_type = "C";

      router.question = Question;
      router.distractor_labels = Distractor_Labels;
      router.response_array = Correct_Response;

      router.tracking = Tracking;
      router.weighting = Weighting;
      router.objective_id = Objective_ID;

      router.navigation = Navigation;
      router.navLabel = Go_To_Label;
      router.navAction = toBoolean(Go_To_Action);

      router.feedback = toBoolean(Feedback);
      router.numOfTries = Num_Of_Tries;
      router.feedback_list = Feedback_List;;
      router.buttonLabels = ButtonLabels;

      router.buttonFlag = false;
      router.resetFlag = false;
      router.checkFlag = false;


      // 3-3: Initialize stage assets

      router.setTextField(Assets.QuestionField, Question);

      if(toBoolean( Feedback ) == false){
      router.setTextField(Assets.FeedbackField, "");
      }

      router.initControlButton(onMCButton);
      router.setFeedback(0);

      var lastInt = _parent.SessionArray[_parent.session-1];
      if( lastInt.Checkboxes ){
      for(var x in lastInt.Checkboxes){
      lastInt.assets_path[lastInt.Checkboxes[x]].selected = null;
      }
      }

      router.sessionStart();
      setMCAssets();

      // 3-4: Hide the component graphics at runtime
      this._visible = false;