# Dynamic selection of text fields

**URL:** <https://forum.kirupa.com/t/dynamic-selection-of-text-fields/231715>\
**Category:** Uncategorized\
**Created:** [July 7, 2007, 12:07am UTC](https://forum.kirupa.com/t/dynamic-selection-of-text-fields/231715 "2007-07-07T00:07:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![orin999](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/orin999/32/3810_2.png) [@orin999](https://forum.kirupa.com/u/orin999)\
**Post date:** [July 7, 2007, 12:07am UTC](https://forum.kirupa.com/t/dynamic-selection-of-text-fields/231715/1 "2007-07-07T00:07:52Z")

</div>

currently i am making textFields in actionscript 2.0 by dynamically creating the name of them and then using \_root.creatTextField. my code works perfectly so long as i run the clip form \_root or \_level0 but i want to be able to load this swf into a empty movieclip among other pages through out my site. but this won’t work so long as i am using \_root. i also select and modify my text fields in the same manner as creating them as seen below. is there an alternative that i can use so that it doesn’t mess up when the movie is not the \_root movie?

function getContent() {  
var fieldCounter:Number = 0;  
for(var i:Number = 0; i \< phpReceiver.n; i++){  
var tempArray\_arr:Array;  
tempStr\_str = phpReceiver[“date”+i.toString()]+ “~” + phpReceiver[“msg”+i.toString()];  
tempArray\_arr = tempStr\_str.split("~");  
totalLines += tempArray\_arr.length;  
for(var j = fieldCounter; j \< (tempArray\_arr.length+fieldCounter); j++){  
var tempName:String = “field”+j+"\_txt";  
\_root.createTextField(tempName, \_root.getNextHighestDepth(), 5, (100 + 20 \* j), 350, 20);  
//\_root[tempName].html = true;  
\_root[tempName].text = tempArray\_arr[j - fieldCounter];  
\_root[tempName].embedFonts = true;  
if(j==fieldCounter){  
\_root[tempName].setTextFormat(dateFormat\_fmt);  
}else{  
\_root[tempName].setTextFormat(txtFormat\_fmt);  
}  
\_root[tempName].type = “dynamic”;  
\_root[tempName].\_xscale = 100 - (j_scaleDifference);  
\_root[tempName].\_yscale = 100 - (j_scaleDifference);  
}  
fieldCounter = totalLines;  
}  
}
