Problem randomizing flash quiz

hi,

i’m a new at flash and am trying to build a quiz that asks questions from a xml file randomly and also randomizes the order of the possible answers. THis is what I have so far codewise…


function QuizItem(question)
{
    this.question = question;
    this.answers = new Array();
    this.numOfAnswers = 0;
    this.correctAnswer = 0;
    this.getQuestion = function ()
    {
        return (this.question);
    };
    this.addAnswer = function (answer, isCorrectAnswer)
    {
        this.answers[this.numOfAnswers] = answer;
        if (isCorrectAnswer)
        {
            this.correctAnswer = this.numOfAnswers;
        } // end if
        ++this.numOfAnswers;
    };
    this.getAnswer = function (answerNumberToGet)
    {
        return (this.answers[answerNumberToGet]);
    };
    this.getCorrectAnswerNumber = function ()
    {
        return (this.correctAnswer);
    };
    this.checkAnswerNumber = function (userAnswerNumber)
    {
        if (userAnswerNumber == this.getCorrectAnswerNumber())
        {
            gotoAndPlay(47);
        }
        else
        {
            gotoAndPlay(56);
        } // end else if
    };
    this.getNumOfAnswers = function ()
    {
        return (this.answers.length);
    };
} // End of the function
function onQuizData(success)
{
    var quizNode = this.firstChild;
    var quizTitleNode = quizNode.firstChild;
    title = quizTitleNode.firstChild.nodeValue;
    var i = 0;
    var itemsNode = quizNode.childNodes[1];
    while (itemsNode.childNodes*)
    {
        var itemNode = itemsNode.childNodes*;
        var questionNode = itemNode.childNodes[0];
        quizItems* = new QuizItem(questionNode.firstChild.nodeValue);
        var a = 1;
        var answerNode = itemNode.childNodes[a++];
        while (answerNode)
        {
            var isCorrectAnswer = false;
            if (answerNode.attributes.correct == "y")
            {
                isCorrectAnswer = true;
            } // end if
            quizItems*.addAnswer(answerNode.firstChild.nodeValue, isCorrectAnswer);
            answerNode = itemNode.childNodes[a++];
        } // end while
        ++i;
    } // end while
    gotoAndPlay(_currentframe + 1);
} // End of the function
var quizItems = new Array();
var myData = new XML();
myData.ignoreWhite = true;
myData.onLoad = onQuizData;
myData.load("quiz.xml");
stop ();

and here is what i have so far xml-wise:


<?xml version="1.0"?>
<!DOCTYPE quiz [
        <!ELEMENT quiz (title, items)>
        <!ELEMENT title (#PCDATA)>
        <!ELEMENT items (item)+>
        <!ELEMENT item (question, answer, answer+)>
        <!ELEMENT question (#PCDATA)>
        <!ELEMENT answer (#PCDATA)>
        <!ELEMENT answer correct (y) #IMPLIED>
]>

<quiz>
  <title>History Review</title>
    <items>
       <item>
         <question>What kind of diplomacy did Taft promote?</question>
         <answer correct="y">Dollar Diplomacy</answer>
         <answer>Moral Diplomacy</answer>
         <answer>Gunboat Diplomacy</answer>
       </item>
       <item>
         <question> </question>
         <answer correct="y"> </answer>
         <answer> </answer>
         <answer> </answer>
         <answer> </answer>
       </item>
    </items>
</quiz>

and just one additional note, i got a fla file off a website that has a tutorial for making a quiz, but thier quiz isnt randomized at all.

so, if anyone could help me, that would be much appreciated! THANKS…