My question is, how can do I take this Multi Dim array collection and apply level 2 to a drop down list,
var someArray:ArrayCollection = new ArrayCollection( [
{ label: "Level 1 p1", data:
{ label: "Level 2", data: "some stuff" }
},
{ label: "Level 1 p2", data:
{ label: "Level 2", data: "some stuff" }
}
] );
<s:DropDownList includeIn="items" id="classSelect" dataProvider="{someArray[0].data}" selectedIndex="0" labelField="label" x="405" y="150"/>
someArray[0].data – for example points it to the entry 1 and the contents of the data level which in turn is a arrayList again, is my understanding here of how the pointers are working incorrect?
I’m not sure what you mean by
If you want to display the level 2 text in the drop down you can do so with an itemRenderer or a labelFunction which drills down into the object to return the text. Conceptually something like this:
If you want the dataProvider to contain nothing but your nested objects, then you’ll have to loop over the someArray value and create a new collection containing only the level 2 objects. Conceptually like this:
I’ll also add, as a point of clarification that your current setting of the dataProvider most likely provides a error because your ‘data’ is a generic object which does implement the IList interface.
If it did work, then you’d end up with a dataProvider that only has a single item in it.