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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:13:31+00:00 2026-05-16T01:13:31+00:00

I have to assume I am missing something simple, or I am not understanding

  • 0

I have to assume I am missing something simple, or I am not understanding something, but I can’t seem to figure this.

I have a list of strings that I add to an array, then attempt to set those values in a for-loop using data that I read in. The array gets updated, but the values the array contains do not. I also have an array of buttons that I update this same way that works great, but strings don’t seem to work the same way. I have tried moving the string array to give it full scope, and still nothing… What am I missing?

public class test extends Sprite
{
  // Declare a list of strings 
  protected var title0:String = undefined;
  protected var title1:String = undefined;
  protected var title2:String = undefined;

  protected function onDataLoad(evt:Event):void{

    var titleArray:Array = new Array(title0,title1,title2); // Array of strings

    for(i=0; i<=evt.target.data.count; i++){
      titleArray[i] = evt.target.data["title"+i]; // attempt to set the title values
    }
  }

  protected function function0(e:Event):void {
    trace("My title is: " + title0); // title0 is null
  }
}
  • 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-05-16T01:13:32+00:00Added an answer on May 16, 2026 at 1:13 am

    It has to do with how AS3 stores Array elements. You would need to explicitly set both the instance property (title1, title2, title3) and the associated array element (array[0], array[1], array[2]) to achieve what you want. Or, you could drop the instance properties (title0, title1, title2) completely and just use the array to store your values. Something like:

    public class test extends Sprite
    {
    
      protected var _titleArray:Array = [];
    
      protected function onDataLoad(evt:Event):void{
    
        for(i=0; i<=evt.target.data.count; i++){
           // set the title values
          _titleArray[i] = evt.target.data["title"+i];
        }
      }
    
      protected function function0(e:Event):void {
        trace("My title is: " + _titleArray[0]);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm stuck! I have this very simple test code and I can't get it
Assume that you have this code in C#/.NET (using PostgreSQL via ODBC): using System.Data.Odbc;
I'm not sure if I am completely mad or missing something but I am
Lets assume we have this xml: <?xml version=1.0 encoding=UTF-8?> <tns:RegistryResponse status=urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure xmlns:tns=urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0 xmlns:rim=urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0> <tns:RegistryErrorList
Lets assume i have a bill number that has 12 numbers: 823 45678912 My
Assume I have a function template like this: template<class T> inline void doStuff(T* arr)
Let's assume I have a model called product. Let's assume that product has three
I am sure this should be easy, perhaps I am missing something obvious. I
Just assume I have some class Foo, that has two dependencies: an ISerializer<T> and
I'm sure I'm missing something obvious, I have an area in which I intend

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.