# Variable in createTextfield

**URL:** <https://forum.kirupa.com/t/variable-in-createtextfield/198371>\
**Category:** Uncategorized\
**Created:** [August 24, 2006, 2:50pm UTC](https://forum.kirupa.com/t/variable-in-createtextfield/198371 "2006-08-24T14:50:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ric373](https://avatars.discourse-cdn.com/v4/letter/r/ed655f/32.png) [@Ric373](https://forum.kirupa.com/u/Ric373)\
**Post date:** [August 24, 2006, 2:50pm UTC](https://forum.kirupa.com/t/variable-in-createtextfield/198371/1 "2006-08-24T14:50:00Z")

</div>

I need to create a textfield from a variable

function createText(instanceName, depth, X, Y, Width, Height) {  
\_root.createTextField(instanceName, depth, X, Y, Width, Height);  
instanceName.embedFonts = false;  
instanceName.antiAliasType = “advanced”;  
instanceName.multiline = true;  
instanceName.wordWrap = true;  
var my\_fmt:TextFormat = new TextFormat();  
my\_fmt.color = 0xFF0000;  
my\_fmt.bold = true;  
instanceName.setTextFormat(my\_fmt);  
}  
createText(“myText”, 1, 20, 40, 150, 75);  
createText(“myTitle”, 2, 20, 20, 150, 20);  
myTitle.text = “hallo”;  
myText.text = “blablablablablbalbalbalablablababalbalbalabla”;

[LEFT]when i use “” in the instanceName, it creates the textfield, but doesn’t format it. When I don’t use the “” it doesn’t make the textfield at al.[/LEFT]

[LEFT]I’ve tried many things like using code to find and replace the " (code can’t find the ")[/LEFT]

[LEFT]I’ve tried to call an extra variable from the function.[/LEFT]  
[FONT=Courier New]  
[/FONT]

[LEFT]But I had no luck. Can someone help me with this?[/LEFT]
