# Change a string to a variable?

**URL:** <https://forum.kirupa.com/t/change-a-string-to-a-variable/111171>\
**Category:** Uncategorized\
**Created:** [May 24, 2004, 1:16pm UTC](https://forum.kirupa.com/t/change-a-string-to-a-variable/111171 "2004-05-24T13:16:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Architect](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@Architect](https://forum.kirupa.com/u/Architect)\
**Post date:** [May 24, 2004, 1:16pm UTC](https://forum.kirupa.com/t/change-a-string-to-a-variable/111171/1 "2004-05-24T13:16:27Z")

</div>

Slight problem here, hope this is even possible…  
I got this :

```auto

columns = new Array(bg_ID, bg_NAME, bg_DIR);
for(i=0;i<result.items.length;i++){
	for(ii=0;ii<columns.length;ii++){
	 itemToAdd = result.items*.columns[ii];
	 trace(itemToAdd);
	}
 }

```

The problem is,  
result.items\*.bg\_ID is the actual container which holds the data.  
However i want to fill in bg\_ID, bg\_NAME…etc… dynamically.

so basically the content of  
itemToAdd = result.items\*.columns[0]  
should refer to the content of  
itemToAdd = result.items\*.bg\_ID

but this is not working… but if i want to obtain the correct data in  
var itemToAdd i have to use result.items\*.bg\_ID?  
or is there a way where i add the expression (result.items\*) and the string from the columns array together then flash will read this as a container which holds data?

hope im clear  
thx already
