# Help Please...XML fontsize attributes and dynamic text fields

**URL:** <https://forum.kirupa.com/t/help-please-xml-fontsize-attributes-and-dynamic-text-fields/234009>\
**Category:** flash\
**Created:** [July 29, 2007, 2:13pm UTC](https://forum.kirupa.com/t/help-please-xml-fontsize-attributes-and-dynamic-text-fields/234009 "2007-07-29T14:13:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dasweb](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@dasweb](https://forum.kirupa.com/u/dasweb)\
**Post date:** [July 29, 2007, 2:13pm UTC](https://forum.kirupa.com/t/help-please-xml-fontsize-attributes-and-dynamic-text-fields/234009/1 "2007-07-29T14:13:20Z")

</div>

I have 10 dynamic text fields on my stage named , xmlTxt1, xmlTxt2, xmlTxt3,etc.

I’d like to loop through and assign a fontsize attribute from an XML file to each dynamic text box.

I’d like to use a variable , myTextField = xmlTxt, and loop through adding 1 each time to xmlTxt to access the dynamic text field names.

Something like this:

var textFieldName = “xmlTxt”;  
myFormat=new TextFormat();  
total = xmlNode.childNodes.length;  
for (i=0; i \< total; i++)  
{  
myFormat.size= Number(xmlNode.childNodes[1].attributes.fontsize); /\* set text field size from XML - no problems with this _/  
textFieldName.text=xmlNode.childNodes_.attributes.textCopy; /\* This is where it goes wrong. _/  
textFieldName.setTextFormat(myFormat);  
var textFieldName = “xmlTxt” + i;  
trace(textFieldName) /_ this shows variable is, xmlTxt1, xmlTxt2, etc. What’s wrong here? \*/  
}
