-
thanks a lot,
this looked much much neater,what about having the choice from an external text file to have 1 answer or 10 and to change the position of the answers or i am dreaming.
-
half as fun, double the price
might as well rename "fig" to frame in your obj and go to and stop to that directly
-
Senior Member
You can make the answers multiple choice (or have answers for equations with more than one solution) by making the answer part of the object an array
eg
quiz[0] = {q: "question", a: ["answera", "answerb", "answerc"], fig: 2}
you could access "answerb" by
quiz[0].a[1];
I think one of the fla files on http://www.angelfire.com/electronic2...math_quiz.html does this (probably the factorising one)
-
[QUOTE]Originally posted by catbert303
[B]You can make the answers multiple choice (or have answers for equations with more than one solution) by making the answer part of the object an array
eg
quiz[0] = {q: "question", a: ["answera", "answerb", "answerc"], fig: 2}
you could access "answerb" by
quiz[0].a[1];
thanks a lot,
this was a second happy thing today - u made my day -, but please dont be nervous, what if i want to pick certain nos of objects from the array (i.e.ant to control the way the questions are browesed to make them random sometimes,serial sometimes and certain questions picked only other times.
-
Senior Member
You can select random questions by using
index = Math.floor(Math.random() * quiz.length);
question = quiz[index].q;
then once the question has been asked you can remove it from the array by using
quiz.splice(index,1);
the quiz is over when quiz.length == 0
-
Senior Member
I guess you could decide how the questions are selected with a variable mode
eg
if (mode == "in_order") {
index++; // move to next question
} else if (mode == "random") {
index = Math.floor(Math.random() * quiz.length);
}
-
sorry, but index++ doesnt get it in a serial order
and what about the extra ability of selecting certain objects from the array, i.e. qus no 2,6 only 4 example, can u help me out plz, thanks in advance.
[Edited by rasha ali on 06-11-2002 at 03:07 PM]
-
Senior Member
Oops, yeah that would be because the array is being spliced, here is some code that works...
In frame 1 have 3 buttons to decide which order the questions are asked and a stop(); action in the frame.
on (release) {
mode = "in order";
gotoAndPlay(2);
}
on (release) {
mode = "increasing random";
gotoAndPlay(2);
}
on (release) {
mode = "random";
gotoAndPlay(2);
}
frame 2
quiz = new Array();
quiz[0] = {q: "x + 1 = 3", a: 2};
quiz[1] = {q: "x - 4 = 2", a: 6};
quiz[2] = {q: "x - 3 = 1", a: 4};
quiz[3] = {q: "2x = 10", a: 5};
quiz[4] = {q: "3x = 12", a: 4};
quiz[5] = {q: "7x = 21", a: 3};
quiz[6] = {q: "2x + 3 = 5", a: 1};
quiz[7] = {q: "4x - 2 = 6", a: 2};
quiz[8] = {q: "9x + 7 = -2", a: -1};
quiz[9] = {q: "2x + 1 = -5", a: -3};
if (mode == "in order") {
index = 0;
} else if (mode == "increasing random") {
index = Math.floor(Math.random() * 3);
} else {
index = Math.floor(Math.random() * quiz.length);
}
score = 0;
displayScore = "Score: " + score;
frame 3
Have the dynamic textboxes question and displayScore along with the input box answer and a submit button. Frame actions like this
question = quiz[index].q;
correctAnswer = quiz[index].a;
Selection.setFocus("answer");
stop();
and on the submit button
on (release) {
if (answer == correctAnswer) {
score++;
displayScore = "Score: " + score;
}
quiz.splice(index,1);
answer = "";
if (quiz.length == 0) {
gotoAndStop("end");
}
if (mode == "increasing random") {
index += Math.ceil(Math.random() * 3);
if (index > quiz.length) {
gotoAndStop("end");
}
} else if (mode == "random") {
index = Math.floor(Math.random() * quiz.length);
}
gotoAndPlay(_currentframe + 1);
}
frame 4
gotoAndStop(_currentframe - 1);
in the frame labelled end just have the displayScore variable and a message telling the user they've finished.
-
catbert303, ive finished the tutorial on maths algebra, do you want a copy of it, seeing that you did help me a lot on it?
if you do, you'll need a fast connection, and msn messenger or icq, seeing that i can only send it through there, seeing that the total files come up to 7MB
-
thanks, serial and random parts did work quit well as i wanted
buttttt ,
sorry, i will try to make it the last question, i think i didnt explain the part considering choosing specific questions well, i mean that i have the ability to write
x = 1,3 to have questions 1 and 3 only displayed
((after finishing i will put x in an external txt file, so as random and serial choice but this isnt my problem now))
my problem is how to pick these 2 objects from the array, i.e. if x=1,3 index values= 0,2 but how ????, thanks.
-
Senior Member
Are you wanting to show to questions to do simultaneous equations?
Anyway, to display 2 questions, you could have 2 dynamic textboxes q1 and q2 or something
then use 2 index variables to select the questions
maybe use something like
index1 = Math.floor(Math.random() * (quiz.length / 2));
index2 = index1 + Math.ceil(Math.random() * (quiz.length / 4));
to pick the index values
q1 = quiz[index1].q;
q2 = quiz[index2].q;
and for the answers,
a1 = quiz[index1].a;
a2 = quiz[index2].a;
-
Originally posted by catbert303
Are you wanting to show to questions to do simultaneous equations?
maybe use something like
index1 = Math.floor(Math.random() * (quiz.length / 2));
index2 = index1 + Math.ceil(Math.random() * (quiz.length / 4));
no, this is not what i want, sorry 4 unclear explanation, what i want is: to get the abilitiy to use the same original file by three different ways by remoting it from another files
first way : random by making rand(variable) =1;
second way : serial by making serial(variable)=1;
and those 2 ways are ok now, the problem is in the third way which is:
picking certain questions by making quno(variable)= 3,7,9
(i have to split this variable inside but what shall i do next to make this variable values the picked indexes ???
//---------------------------------------------------
and so the same file can be loaded with three different ways depending on the value of these variables (i.e. from file 1.swf i call the quiz with making rand=1 so the file will be displayed random
but from file 2.swf i call the same file with making quno=3,7 what makes no. three and seven only to be displayed
one after the other as if the array contains them only
//-------------------------------------------------------
thanks.
-
Senior Mender
Wow ... i think that's the help section longest thread...
5 page of helping what a great community...
I no i'm not helping but i'm stunt... And have to share my emotion
-
hello everybody,
catbert303 where r u? i need help here in the choice of questions part here is my code plz tell me what is going wrong, because the whole array of questions is displayed again
note:quno is a variable readed from another swf
e.g. quno=1,2;
-----------------------------------------------------------my code :
if(choose==1)
{
indexarray=quno.split(",");
numQuestions =Number(choosearray.length);
for (j=0;j<indexarray.length;j++)
{
choosearray =new Array (indexarray.length);
choosearray[j]=quiz[Number(indexarray[j])];
}
index = Math.floor(Math.random()*choosearray.length);
}
------------------------------------------------------------
when i make ctrl shift v when testing movie i found:
1- indexarray is ok it reads 1 and 2 in it.
2- choosearray does read one object only not two as it is supposed to do.
-
Senior Member
If you email me the fla file (and the file you load variables from) I can try to take a look at it, see if I can work out what going wrong with it
email catbert303@yahoo.com
-
Originally posted by catbert303
If you email me the fla file (and the file you load variables from) I can try to take a look at it, see if I can work out what going wrong with it
email catbert303@yahoo.com
hello catbert303,
i have sent u the mail is there any news
-
Senior Member
Originally posted by rasha ali
hello catbert303,
i have sent u the mail is there any news
Could you send your text file too? I can't test easily without knowing what variables are coming from the file, thanks
-
Originally posted by catbert303
Originally posted by rasha ali
hello catbert303,
i have sent u the mail is there any news
Could you send your text file too? I can't test easily without knowing what variables are coming from the file, thanks
thanks,
i have sent u the txt file now.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|