# Flash Quiz Template / Checkbox styling problem

**URL:** <https://forum.kirupa.com/t/flash-quiz-template-checkbox-styling-problem/254498>\
**Category:** flash\
**Created:** [March 12, 2008, 6:46pm UTC](https://forum.kirupa.com/t/flash-quiz-template-checkbox-styling-problem/254498 "2008-03-12T18:46:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JUICE690](https://avatars.discourse-cdn.com/v4/letter/j/97f17d/32.png) [@JUICE690](https://forum.kirupa.com/u/JUICE690)\
**Post date:** [March 12, 2008, 6:46pm UTC](https://forum.kirupa.com/t/flash-quiz-template-checkbox-styling-problem/254498/1 "2008-03-12T18:46:01Z")

</div>

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 ![](http://forum.kirupa.com/uploads/kirupa/1105/8ed432c9025fd9ca.gif)

Thanks for any help (hope I’m posting this in the right section ![](http://forum.kirupa.com/uploads/kirupa/3617/361341c146e0850c.gif) )

/\*--------------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 &lt; 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 &lt; 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 &lt; 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 &gt; 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 &lt; 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 &gt; 1) {
	router.correct_response = "{"+answer_format.toString()+"}";
} else {
	router.correct_response = answer_format.toString();
}

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

if(totalChecked &lt;= 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;
