04-17-2003, 11:41 PM
|
#1
|
|
[AS]FlashyLearner++[/AS]
Join Date: Jul 2002
Location: India
Posts: 342
|
combox quiz
ActionScript Code:
vat total = 0;
var q1Labels = new Array("Webdesign","Database","Animation");
var q1Data = new Array(1,2,3);
for(var i = 0; i<q1Data.length; i++){
q1_cb.addItem(q1Labels[i],q1Data[i]);
}
q1_cb.setChangeHandler("onItemPicked");
/*onItemPicked = function(){
trace(test_cb.getSelectedItem().data);
}*/
var q2Labels = new Array("Microsoft","Flashy","Macromedia");
var q2Data = new Array(1,2,3);
for(var i = 0; i <q2Data.length; i ++){
q2_cb.addItem(q2Labels[i],q2Data[i]);
}
var q3Labels = new Array("Shockwave Plug-in","All Macromedia", "Flash plug-in");
var q3Data = new Array (1,2,3);
q3_cb.setSize(150);
for(var i = 0; i <q3Data.length; i++){
q3_cb.addItem(q3Labels[i],q3Data[i]);
q3_cb.getSelectedItem()
}
var correctAnswers = new Array(3,3,3);
function chkAnswers(){
for (i= 1; i<=correctAnswers.length; i++){
if(q[i]_cb.getSelectedItem().data == correctAnswers[i]){
total++;
trace("total "+total);
// trace(q[i]_cb.getSelectedItem().data == correctAnswers[i]);
}
}
}
I am trying to create a quiz using combox component. I am not sure how to go about correcting the answers.
pls. let me know where I am going wrong.
a sample file at www4.ncsu.edu/~bjagann/forum/cb.zip
thnx!
|
|
|
04-18-2003, 04:03 AM
|
#2
|
|
Super Moderator
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
|
Howdy...
I saw the other thread with the same problem... Should I say this is the crossposting as well???
Same thing applies here...
ActionScript Code:
if ([b]this["q" + i + "_cb"][/b].getSelectedItem().data == correctAnswers[i])
Oh... You are not allowed to use my initial as a file name...
|
|
|
04-18-2003, 04:11 AM
|
#3
|
|
[AS]FlashyLearner++[/AS]
Join Date: Jul 2002
Location: India
Posts: 342
|
thnx CyanBlue...
yeah.. it was sort of cross-posting!!
i copied out the simple step so that i will be able to get some help... in the General Help section. have a deadline to work tonight... hence the neediness
i always gets stuck in this path (i know i am asking the same kinda problem the second time in this forum)
thnx!! a long night to go!!
|
|
|
04-18-2003, 04:26 AM
|
#4
|
|
Super Moderator
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
|
Sure... Holler me when you need me... Don't know how long I am going to be up tonight, but I'll be around...
That pathing stuff... Yeah... That's the pain... But you gotta get over it cuz there are bigger waves of pain coming to you... Lots of mountains to climb to get us one step ahead...
|
|
|
04-18-2003, 04:39 AM
|
#5
|
|
[AS]FlashyLearner++[/AS]
Join Date: Jul 2002
Location: India
Posts: 342
|
thnx CyanBlue..
am stuck here....
am creating a quiz... with combox box values.. to be checked...
the last part of the quiz.. to check whether correct or not..
i need to put a correct mark/ incorrect mark at the side when btn_check button is pressed.
ActionScript Code:
btn_check.onPress = function() {
var correctAnswers = new Array(1, 2, 3, 1, 2, 3,1, 2);
var userAnswers = new Array(q1_cb.getValue(), q2_cb.getValue(), q3_cb.getValue(), q4_cb.getValue(), q5_cb.getValue(), q6_cb.getValue(), q7_cb.getValue(), q8_cb.getValue());
for (i=0; i<=8; i++) {
if (userAnswers[i] == correctAnswers[i]) {
this["holder"+i].attachMovie("tick", "tick"+i, i);
trace(this["holder"+i]);
trace("userAnswers "+ userAnswers[i] + " correctAnswer "+ correctAnswers[i]);
total++
trace(total);
} else {
this["holder"+i].attachMovie("wrong", "wrong"+i, i);
}
}
};
let me know, if u need the file..
"holder" - is an empty mc
"tick" is the linkage to the mc in the library
"wrong" - dido
thnx
Last edited by texbala; 04-18-2003 at 04:43 AM.
|
|
|
04-18-2003, 04:45 AM
|
#6
|
|
Super Moderator
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
|
Yeah... File would be easier... I thought that I was going to add that part in your last file, but I see that it is different one... Let me know the URL...
Oh... Forgot to ask one more thing... What is the thing you want me to check???
|
|
|
04-18-2003, 04:50 AM
|
#7
|
|
[AS]FlashyLearner++[/AS]
Join Date: Jul 2002
Location: India
Posts: 342
|
|
|
|
04-18-2003, 05:06 AM
|
#8
|
|
[AS]FlashyLearner++[/AS]
Join Date: Jul 2002
Location: India
Posts: 342
|
also.. i need to add two possible answers for the second/ third question
the file that i had sent... doesn't have "tick" and "wrong"
also.. i need to make the holder either have correct/ wrong mc's.
|
|
|
04-18-2003, 05:15 AM
|
#9
|
|
Super Moderator
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
|
Um... Let's not go that fast... Check out the file first and see if I am getting it right... I don't know what you want me to fix cuz your attachMovie() function worked just fine to me... Hm... Let me know first...
|
|
|
04-18-2003, 05:23 AM
|
#10
|
|
[AS]FlashyLearner++[/AS]
Join Date: Jul 2002
Location: India
Posts: 342
|
for me.. the attachMovie didn't work.. that was the only problem when i posted it...
the next problem.. how can i add two answers to be correct.
also.. did u check to see whether the right answers have the blue and the wrong answers have the red... for me.. sometimes it doens't match... ?? am i missing something??
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 04:28 AM.
///
|
|