monAmour
February 26th, 2004, 04:54 AM
I'm trying to build a prototype for strings to be loaded into textfields.
I want to break up a string and put each and every char in it in to the textfield with a 1 second interval.
This is what I've come up with, I don't get any script errors but nothing seems to work anyway.
Any ideas how to accomplish this?
var myText:String = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wi";
TextField.prototype.animateString = function(strObj:String) {
var charCount:Number = strObj.length-1;
var c:Number = 0;
function animStr(strObj:String, strLength:Number) {
if (c < strLength) {
var input:String = strObj.charAt(c);
this.text = this.text + input;
c++;
animInt = setInterval(animStr, 1000);
}
else {
clearInterval(animInt);
}
}
animStr(strObj, charCount);
}
theText.animateString(myText);
Expl: This script is within the first frame of my movie. The textField named "theText" is also put there.
I want to break up a string and put each and every char in it in to the textfield with a 1 second interval.
This is what I've come up with, I don't get any script errors but nothing seems to work anyway.
Any ideas how to accomplish this?
var myText:String = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wi";
TextField.prototype.animateString = function(strObj:String) {
var charCount:Number = strObj.length-1;
var c:Number = 0;
function animStr(strObj:String, strLength:Number) {
if (c < strLength) {
var input:String = strObj.charAt(c);
this.text = this.text + input;
c++;
animInt = setInterval(animStr, 1000);
}
else {
clearInterval(animInt);
}
}
animStr(strObj, charCount);
}
theText.animateString(myText);
Expl: This script is within the first frame of my movie. The textField named "theText" is also put there.