# Creating variables on the fly

**URL:** <https://forum.kirupa.com/t/creating-variables-on-the-fly/79514>\
**Category:** flash\
**Created:** [February 14, 2005, 9:23pm UTC](https://forum.kirupa.com/t/creating-variables-on-the-fly/79514 "2005-02-14T21:23:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nath\_y](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@nath\_y](https://forum.kirupa.com/u/nath_y)\
**Post date:** [February 14, 2005, 9:23pm UTC](https://forum.kirupa.com/t/creating-variables-on-the-fly/79514/1 "2005-02-14T21:23:47Z")

</div>

I can’t get flash to recognize variable names that I create on the fly.

For instance, I have dynamic text boxes named slideText1, slideText2, and slideText3, etc, which I want to fill with data from an XML file. In this code, the trace spits out the proper variable name, but Flash won’t recognise it as a variable, and so does not update the dynamic text accordingly.

(i=1; i\<(totalSlides+1); i++) {  
variable\_holder=“slideText”+i;  
variable\_holder= currentSlideNode.firstChild.nodeValue;  
trace(variable\_holder);  
currentSlideNode=currentSlideNode.nextSibling;  
}

I’ve tried eval and arrays, but can’t create variable names on the fly. Help?
