all groups > flash actionscript > september 2007 >
You're in the

flash actionscript

group:

Saving to Array and pulling out


Saving to Array and pulling out maureen27
9/23/2007 4:22:11 PM
flash actionscript:
Need some help. Trying to learn.
I have sections with questions and answers which I can get.
But, I need to save each section into new array and tally all the final scores.
The screen will show the section score of current section that was just
completed
and the final score.

I know the code has lots of problems - attached.

For the total scores the dynamic text boxes var's are totalnumcorrect,
totalnumIncorrect, totaluserScore.

For the section score the dynamic text boxes var's are numcorrect,
totalnumIncorrect, totaluserScore.


The title changes for each section, so I using that with if statement.

Can someone help please.

Thanks


//final scores
var quizTitleNode=quizNode.firstChild;
title=quizTitleNode.firstChild.nodeValue;

//section scores
section[i] = new Array(numCorrect, numIncorrect, userScore);

// total score
if (quizTitleNode.firstChild.nodeValue = "Section 1: The Mountains") {
section[i] = section1;
}

else if
(quizTitleNode.firstChild.nodeValue = "section 2: The Fields") {
section[i] = section2;
}

else if
(quizTitleNode.firstChild.nodeValue = "section 3: The Rivers") {
section[i] = section3;
}


//section scores as nested arrays
sectionsArray = new Array (section1, section2, section3);

function countFinalScore() {

for(var i=0; i = sectionsArray[0].length; i++);

}
Re: Saving to Array and pulling out kglad
9/23/2007 10:14:44 PM
there are plenty of problems with (what appears to be) your actionscript. just
about every line has an error, after the first 2 lines.

i'm not sure how to correct most of the errors because it's not clear what
you're trying to accomplish. one thing that is immediately correctable: use
double equal (==) when testing for equality.
AddThis Social Bookmark Button