Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9202265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:12:54+00:00 2026-06-17T23:12:54+00:00

answer = new Array(); answer[0] = 1997; answer[1] = 1941; question = new Array();

  • 0
  answer = new Array();
answer[0] = "1997";
answer[1] = "1941";
question = new Array();
question[0] = "What ...?";
question[1] = "Why ...?";

question_txt.text = question;
enter1.onRelease = function()
{
    if (answer_input.text == answer)
    {
        answer++;
        question++;
        question_txt.text = question;
    }
    else
    {
        answer_input.text = "Incorrect";
    }
};

There’s 2 text boxes and a button
TextBox1 = question_txt – which is to display the question and is of type [Dynamic]
textBox2 = answer_input – which is to allow users to attempt to answer the question

The values of the answers and questions are just made up, don’t mind them.

So why isn’t it working?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:12:55+00:00Added an answer on June 17, 2026 at 11:12 pm

    Well, I’m no as2 expert, but it looks like question is an array, and you’re trying to set question_txt.text to question, which is really the entire array. And then later, you’re trying to add 1 to the answer and question arrays, which won’t work.

    What you’re really looking to do is access elements of these arrays, and to do that, you need to pass an index to your array. (question[0] = “The first element in the question array”) So what you need is a variable that keeps track of the index of these arrays you’re currently using. Something like this…

    answer = new Array();
    answer[0] = "1997";
    answer[1] = "1941";
    question = new Array();
    question[0] = "What ...?";
    question[1] = "Why ...?";
    
    qanda_number = 0;
    
    
    question_txt.text = question[qanda_number];
    enter1.onRelease = function()
    {
        if (answer_input.text == answer[qanda_number)
        {
            qanda_number++;
            question_txt.text = question[qanda_number];
            // You probably want to empty out your answer textfield, too.
        }
        else
        {
            answer_input.text = "Incorrect";
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made this function: function transliterate(word){ var answer = ; A = new Array();
I am new to SharePoint, sorry if answer to my question is obvious. I
new here and new to jQuery. I've searched for an answer to my question/
I am new to Emacs. I have googled this but no good answer there.
Crockford writes in http://javascript.crockford.com/survey.html : There are two ways to make a new array:
<script type=text/javascript> function prepare_values() {ldelim} var flag= true; var i=0; var total_questions = new
OK I have this function (I got as the answer to this question )
One answer is to create a new array that is one element shorter. Are
window.global_array = new Array(); window.example = function() { var x = new Object(); x['test_property']
I have a question with an array of answers. Each answer has a boolean

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.