# createTextField() not displaying. dynamic text

**URL:** <https://forum.kirupa.com/t/createtextfield-not-displaying-dynamic-text/195844>\
**Category:** flash\
**Created:** [August 3, 2006, 3:30pm UTC](https://forum.kirupa.com/t/createtextfield-not-displaying-dynamic-text/195844 "2006-08-03T15:30:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Case\_Sensitive](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@Case\_Sensitive](https://forum.kirupa.com/u/Case_Sensitive)\
**Post date:** [August 3, 2006, 3:30pm UTC](https://forum.kirupa.com/t/createtextfield-not-displaying-dynamic-text/195844/1 "2006-08-03T15:30:24Z")

</div>

Hi

Im trying to create textfield inside my movieclip dynamically (at runtime). So I created a function called “CreateTextField()” which accepts parameters, including the “instanceName” and “txtValue”.

Inside that function is a MovieClip.createTextField() function that takes the values and creates a textfield with the “instanceName” provided and assigns a value to the .text property of the textfield through “txtValue”.

The code compiles. But it just doesnt want to show the textfield.

What Ive got in my constructor is:

```auto

CreateTextField("txtNum", "02.", 0, 120, 18, 30, 30);

```

The CreateTextField function:

```auto

public function CreateTextField(instanceName:String, txtValue:String, depth:Number, x:Number, y:Number, width:Number, height:Number)
    {
        mcButton.createTextField(instanceName, depth, x, y, width, height);
        trace(mcButton.instanceName._name);
        
        //format information for the textfield
        var txtFieldFormat = new TextFormat();     
        
        //format the look of the textfield
        txtFieldFormat.bold = true;
        txtFieldFormat.color = 0xFFFFFF;
        txtFieldFormat.font = "_sans";
    
        //assign a value to the textfield
        mcButton.instanceName.text = txtValue;
        mcButton.instanceName.setTextFormat(txtFieldFormat);
    }

```

Does any one have an idea as to whats going on. I think it has to do with my instanceName as when i run trace it outputs: undefined

Any help would be great

Cheers
