# Problems with dynamically created Text Field

**URL:** <https://forum.kirupa.com/t/problems-with-dynamically-created-text-field/159056>\
**Category:** flash\
**Created:** [August 14, 2005, 10:49am UTC](https://forum.kirupa.com/t/problems-with-dynamically-created-text-field/159056 "2005-08-14T10:49:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pup\_100](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@Pup\_100](https://forum.kirupa.com/u/Pup_100)\
**Post date:** [August 14, 2005, 10:49am UTC](https://forum.kirupa.com/t/problems-with-dynamically-created-text-field/159056/1 "2005-08-14T10:49:51Z")

</div>

[font=Times New Roman]Morning all,[/font]

[font=Times New Roman]I’m dynamically creating a text field using “createTextField” as part of a larger method that runs through a line of text & animates it by setting each letter to uppercase every 100th of a second.[/font]

[font=Times New Roman]The problem that I have is that the dynamic filed I’m creating for some reason creates a second line of identical text which it tags onto the first so say the text to be displayed was just “Eat a grape” I’m getting [/font]

[font=Times New Roman]“Eat a grapeEat a grape”[/font]

[font=Times New Roman]A link to an online version of the site is [HERE](http://www.jdwyer.plus.com/toupper.html) & the complete code is set out below:[/font]

```auto
 TextField.prototype.caseAni= function(msg){ 
 
var tf=this;
 
tf.uppperIndex=0;
 
tf.msg=msg;
 
var id=setInterval(moveUppercaseLetter,100);
 
function moveUppercaseLetter(){
 
var part1=tf.msg.slice(0,tf.upperIndex);
 
var part2=tf.msg.charAt(tf.upperIndex);
 
var part2=part2.toUpperCase();
 
var part3=tf.msg.slice(tf.upperIndex+1,tf.msg.length);
 
tf.msg=part1+part2+part3;
 
 
 
tf.text=tf.msg;
 
 
 
tf.msg=tf.msg.toLowerCase();
 
 
 
tf.upperIndex++;
 
 
 
if(tf.upperIndex> (tf.msg.length-1)){
 
tf.upperIndex=0;
 
}
 
}
 
}
 
this.createTextField("msgOutput_txt",1,0,0,300,30);
 
msgOutput_txt.setNewTextFormat(new TextFormat("_typewriter",16));
 
msgOutput_txt.caseAni("This is just a simple test"); 

```
