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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:07:43+00:00 2026-05-31T05:07:43+00:00

I am attempting to build an array of arrays that will with the following

  • 0

I am attempting to build an array of arrays that will with the following syntax. My output is definitely not what I am trying to achieve. Here is my code:

var labs:ArrayCollection = new ArrayCollection();
    var sets:ArrayCollection = new ArrayCollection();

    var labsArray:Array = ["ProDPI","WHCC","Tin"];
    var setsArray:Array = ["Set1","Set2","Set3"];

    var folders:ArrayCollection = new ArrayCollection();
    var foldersArray:Array = [labsArray, setsArray];

    var objFolderBuild:Object = new Object;

        for (var i:int = 0; i< foldersArray.length;i++) {
                for (var j:int = 0; j < foldersArray[i].length; j++) {
                    objFolderBuild.labName = foldersArray[i][j];
                    folders.addItem(objFolderBuild);
                }
        }
labFolderList.labelField="labName";
labFolderList.dataProvider=folders;
setFolderList.labelField="setName";
setFolderList.dataProvider=folders;

My output is coming out as 6 references to “Set3”. There is obviously something wrong with my for loops, but I can’t figure it out. Any ideas would be a great help.

  • 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-31T05:07:44+00:00Added an answer on May 31, 2026 at 5:07 am

    I threw together this quick app to prove that your code is properly tracing out the foldersArray[i][j]. It’s 90% the code from your app.

    However, I want to point out that the objFoldersBuild object is only created once. So what you do each time through the loop is change the value of an existing object’s property and add it to your folders ArrayCollection. You have an ArrayCollection with multiple copies of the same exact object. The answer is to create a new object each time through the loop.

    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                           xmlns:s="library://ns.adobe.com/flex/spark" 
                           xmlns:mx="library://ns.adobe.com/flex/mx" preinitialize="windowedapplication1_preinitializeHandler(event)">
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.events.FlexEvent;
    
                protected function windowedapplication1_preinitializeHandler(event:FlexEvent):void
                {
                    var labs:ArrayCollection = new ArrayCollection();
                    var sets:ArrayCollection = new ArrayCollection();
    
                    var labsArray:Array = ["ProDPI","WHCC","Tin"];
                    var setsArray:Array = ["Set1","Set2","Set3"];
    
                    var folders:ArrayCollection = new ArrayCollection();
                    var foldersArray:Array = [labsArray, setsArray];
    
                    var objFolderBuild:Object = new Object;
    
                    for (var i:int = 0; i< foldersArray.length;i++) {
                        for (var j:int = 0; j < foldersArray[i].length; j++) {
                            trace(foldersArray[i][j]);
                                    objFolderBuild  = new Object;
                            objFolderBuild.labName = foldersArray[i][j];
                            folders.addItem(objFolderBuild);
                        }
                    }
    /*              labFolderList.labelField="labName";
                    labFolderList.dataProvider=folders;
                    setFolderList.labelField="setName";
                    setFolderList.dataProvider=folders; */
                }
    
            ]]>
        </fx:Script>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
    </s:WindowedApplication>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to build some C++ code that requires the Windows 7.0 SDK header
When attempting to build a c++ program containing the following code: menutype::menutype(int cat_num){ extras
I'm attempting to build a function that will return a regex that is dynamically
I'm attempting to build a generic method that will convert any IEnumerable to an
I'm attempting to build a method call from strings that have been passed into
I am attempting to build a backup script that moves a tar file from
I'm attempting to build a custom control for Formtastic that takes a latitude and
I am attempting to build a website that utilizes facebook auth based setting created
I was attempting to use the following if/else statements to build a query, but
I'm attempting to build a decorator for an instance method of a class that

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.