Today, I am bored with reading the usage of this check box. It is indeed a good choice to use it to create multiple choice questions. Drag four components on the component panel,
Modify its label to make it an appropriate answer. There are also some data values and the selected status.
After setting the attributes of the component, let's start making the component. The idea is: since it is a single-choice question, each single-choice question has a unique answer. There are only two States: Correct answer and wrong answer. If a question has a score or no score, we can set a variable value for each question. This variable value is used to calculate the score of this question. Because it is done in several frames, a global variable is set for each question. See the following code
The first frame of code:
Stop ();
_global.sum=0;var obj=new Object();obj.click=function(evt){ if (evt.target ==mc1){ sum=evt.target.data;trace(sum);}else if(evt.target ==mc2){sum=evt.target.data;trace(sum);}else if(evt.target ==mc3){sum=evt.target.data;trace(sum);}else if(evt.target ==mc4){sum=evt.target.data;trace(sum);}}mc1.addEventListener("click",obj);mc2.addEventListener("click",obj);mc3.addEventListener("click",obj);mc4.addEventListener("click",obj);
Set the name of each component to mc1, MC2, MC3, and mc4.
Frame 2:
Stop ();
_global.sum2=0;var obj=new Object();obj.click=function(evt){ if (evt.target ==mc5){ sum2=evt.target.data;trace(sum2);}else if(evt.target ==mc6){sum2=evt.target.data;trace(sum2);}else if(evt.target ==mc7){sum2=evt.target.data;trace(sum2);}else if(evt.target ==mc8){sum2=evt.target.data;trace(sum2);}}mc5.addEventListener("click",obj);mc6.addEventListener("click",obj);mc7.addEventListener("click",obj);mc8.addEventListener("click",obj);
Finally, calculate the total score of each choice question:
Frame 3:
stop();btn2.onRelease=function(){msg=sum+sum2;trace(msg);}
Well, This completes the scoring of two single-choice questions, which is good for multimedia.
Note recorded! Tired ..