Problems with dynamically created Text Field

[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 & the complete code is set out below:[/font]

 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");