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 8023389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:33:03+00:00 2026-06-04T22:33:03+00:00

This is incapable of finding the appropriate variable array1 despite it clearly being declared

  • 0

“This” is incapable of finding the appropriate variable “array1” despite it clearly being declared within the function. But if I declare the variables outside of the function it works. How can I have the variables inside the function but keep it working?

package 
{

public class main extends MovieClip
{
//If I declared the variables here it would work.
    public function main():void
    {
        var array1:Array = [1,2];
        var array2:Array = [3,4];
        trace(this["array"+1][1]); //returns reference error 1069   
    }

}
}

Am I stuck with declaring the variables outside of the function?

And no, multidimensional arrays won’t work for what I need it for. Though it looks like it would solve everything within the code snippet provided huh?

My intentions is to pass arrays through a class to be used and change which array bunch I use. If I used multidimensional arrays, it would be inefficient due to the amount of copying that would occur.

  • 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-04T22:33:06+00:00Added an answer on June 4, 2026 at 10:33 pm

    For this[] to access properties, those properties must belong to this. In your sample, the properties belong to the function in which they were defined and are inaccessible outside of that scope.

    So firstly; yes, for your code to work you will of course need to define properties in the class level scope.

    But more importantly I’d look closely at what you’re trying to do and determine whether it’s a good approach – my bet is that it’s not. It seems like you may want to consider an isolated class that deals with all the data you want to store.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should be simple, but the answer is eluding me. If I've got a
this is my code that I write it but I want to use LINQ
This is probably a stupid question, but how much of a security risk is
I've been researching this on and off for a number of months now, but
Not sure if this belongs on SO but nonetheless it involves web dev/programming... I
I've found myself incapable of utilizing draw methods to display images within a JFrame.
This question was posted on StackApps , but the issue may be more a
This is a pretty simple question, and I searched the previous questions but couldn't
This is probably basic stuff, but I can't find the clear answer anywhere.. Lets
This is a normalization thing, but I want I have to hold information about

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.