# Combining object array and accessing object property name

**URL:** <https://forum.kirupa.com/t/combining-object-array-and-accessing-object-property-name/307379>\
**Category:** flash\
**Created:** [April 2, 2010, 10:21am UTC](https://forum.kirupa.com/t/combining-object-array-and-accessing-object-property-name/307379 "2010-04-02T10:21:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![laaptu](https://avatars.discourse-cdn.com/v4/letter/l/76d3ee/32.png) [@laaptu](https://forum.kirupa.com/u/laaptu)\
**Post date:** [April 2, 2010, 10:21am UTC](https://forum.kirupa.com/t/combining-object-array-and-accessing-object-property-name/307379/1 "2010-04-02T10:21:26Z")

</div>

I have an xml say in following format

```php

     <color>
 <colorName>red,blue,green</colorName>
 <hexValue>0xffffff,0x0000,0xcdeff,</hexValue>
</color>
 

```

I load the xml and parse it in following manner

```php

     for(var i:int =0;i<xmlList.length();i++)
{
  var nodeName:String = xmlList*.name();    
  //here datalength =3
  var nodeArray:Array = nodeData.split(",",dataLength);
 //now I loop through this nodearray to creat an object array
   for(var j:int =0;j<nodeArray.length;j++)
     {
    dataArray.push({nodeName:nodeArray[j]});
     }
  //now I push this dataArray into my final Array
  mainArray.push(dataArray);
}

```

Now what I want to do is create an array in following format based upon above code

```php

     myArray.push({colorName:value,hexValue:value});
i.e. it should store values in following format
myArray[0].colorName = red;
myArray[0].hexValue =oxfffff;
// here i should dynamically get colorName as object property and so its value 

```

\</div\>

What I should do is parse an xml and from its node name create object property and then create an object array based on those property.  
Am I able to make myself clear.  
I am still looking for solution and if I find I will post here.I am submitting this query if anyone has certain idea on how to implemnt it
