AS2 object property referencing problem

Hi,

I’m new to the forum but would really apreciate some help!

I’m trying to do a simple quiz game in AS2 using flash CS3. I just need some help referencing the property of an object depending on a variable “currentQuestion”

-----creating my objects---------

questions = new Object();
questions.question1 = { id: "1", text: "what is 1+1", correctAnswer: "2",
    answer1: "2", answer2: "4", answer3: "6", answer4: "8" };
    
questions.question2 = { id: "2", text: "what is 2+2", correctAnswer: "4",
    answer1: "4", answer2: "6", answer3: "8", answer4: "10" };
    
questions.question3 = { id: "3", text: "what is 3+3", correctAnswer: "6",
    answer1: "6", answer2: "8", answer3: "10", answer4: "12" };
    
questions.question4 = { id: "4", text: "what is 4+4", correctAnswer: "8",
    answer1: "8", answer2: "10", answer3: "12", answer4: "14" };

------later on-------------------------------------------------------

questions.checkAnswer = function(buttonPressed, currentQuestion) 
{
    if (ans_one_TXT.text == questions.question2.correctAnswer)
        q = "Correct";
    else q = "Incorrect";
    return q;
}

instead of question2 i need it to change depending on the current question variable so like;

questions.question(currentQuestion).correctAnswer

but oviously not because this dosen’t work :frowning:

i’m oviously a beginer using actionscript and i know my code is horrible but i just want to get this project finished :frowning:

Thanks in advance for the help!