Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>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.</p> <p>However, I want to point out that the <code>objFoldersBuild</code> 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.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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)"&gt; &lt;fx:Script&gt; &lt;![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&lt; foldersArray.length;i++) { for (var j:int = 0; j &lt; 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; */ } ]]&gt; &lt;/fx:Script&gt; &lt;fx:Declarations&gt; &lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt; &lt;/fx:Declarations&gt; &lt;/s:WindowedApplication&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload