# Help needed with dynamic textfields

**URL:** <https://forum.kirupa.com/t/help-needed-with-dynamic-textfields/113750>\
**Category:** Uncategorized\
**Created:** [June 21, 2004, 4:54pm UTC](https://forum.kirupa.com/t/help-needed-with-dynamic-textfields/113750 "2004-06-21T16:54:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![firstSteps](https://avatars.discourse-cdn.com/v4/letter/f/b487fb/32.png) [@firstSteps](https://forum.kirupa.com/u/firstSteps)\
**Post date:** [June 21, 2004, 4:54pm UTC](https://forum.kirupa.com/t/help-needed-with-dynamic-textfields/113750/1 "2004-06-21T16:54:12Z")

</div>

Hi all,  
i have used this code to make a textfield, but would like to know how to change it into a function so i can re-create the textfields anywhere i like and just change the value of tData to an other string.Im using 2004pro and actionScript2  
//--------------------------------------------------------------------  
var nWidth:Number = mcDisplayBackground.\_width;  
var nHeight:Number = mcDisplayBackground.\_height+1;  
var nX:Number = mcDisplayBackground.\_x+3;  
var nY:Number = mcDisplayBackground.\_y-1.5;  
this.createTextField(“tData”, this.getNextHighestDepth(), nX, nY, nWidth, nHeight);  
tData.text = “INTERACTIVE PORTFOLIO”;  
tData.selectable = false;  
tData.multiline = false;  
tData.wordWrap = false;  
var tfFormatter:TextFormat = new TextFormat();  
tfFormatter.font = “kroeger 05\_56”;  
tfFormatter.size = 8;  
tfFormatter.color = 0x7fdc09;  
tData.setTextFormat(tfFormatter);  
};  
//------------------------------------------------------------

any help would be welcome

firstSteps
