Getting column names from arrayCollection

I wish to loop over an array collection and access all the elements (columns)

so the arrayCollection looks like


I need to loop over the rows and columns, but dont know the column names, any ideas.
LVL 18
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try this:

It worked in AS2 and it wont work for bindable properties but it works for simple objects.

for (var key:String in object)
    data = object[key] ;

where object is your arraycollection item ie ac[0]

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PluckaAuthor Commented:
Cool, I tried that but must have had something wrong.
I'm a novice at Flex, ActionScript, and object oriented programming in general.  I'm trying to have a multi-dimension array (arrayCollection) (2 dimension) and want to access the column data using the first dimension (row pointer) (which is a string) as variable to point to the other  columns in the array.  I currently have:
private function getArrayDataValue(currentArray:ArrayCollection,fieldLabel:String):String {
var key:String = fieldLabel;
var displayValue:String = currentArray[key].data;
return displayValue;
I am getting the following error on execution:
Error: Unknown Property: 'freightTerms'.
      at mx.collections::ListCollectionView/[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\]
      at com.olt.transportation.update::UpdateFullView/getArrayDataValue()[C:\adobeFlexTraining\_workspace\FlexBuilder\src\com\olt\transportation\update\UpdateFullView.mxml:55]
      at <anonymous>()[C:\adobeFlexTraining\_workspace\FlexBuilder\src\com\olt\transportation\update\UpdateFullView.mxml:70]

The code calling the function is:
<mx:Label id="freightTerms" text="{getArrayDataValue(updateTR,'freightTerms')}"/>

Any reasonable suggestion will be greatly appreciated.
An arrayCollection is not really a multidimetional array.  Its an array of Objects.

Also to access arrayCollection elements you must use


you cant do myArrayColelction[1]
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.