loadText = new LoadVars();
> i = int(Math.random()*20+1);
> loadText.load(i+".txt");
> j = 0;
> //creating the loadVarsText function
> loadText.onLoad = function() {
> scroller.htmlText = this.myText;
> j = this.answer;
> };
>
> this code will load random questions (named q1.txt - q20.txt) into the text
area. the questions are identified by the variable “myText”. also in the text
files are the answers. the answers are identified by the variable “answers”. a
sample of the text file q1.txt is as below:
> myText=
> <font face=“Verdana” size=“10” color="#FF0000">
> <b>Digestion</b></font><font face=“Verdana” size=“10”>
> Which of the following are enzymes found in the stomach? <br> 1) Amylase
2) Maltase <br> 3) Pepsin 4) Sucrase</font>
> answer=3
>
> i am able to successfully load myText into the text area. however, i am not
able to assign the variable “answer” to the local variable “j”. (which i will
use later on for quiz answer checking).
> is there anyway i am able to load the answer into variable j?
> can you please correct me if i am wrong in this comparison of string:
> if (j===“1”) {
> (play animation for correct answer)