Hello everyone, im having a hard time achieving a “write on” effect with flash using multiple dynamic text fields.
Here’s the code I put on the first frame:
var string_1:String = "Latest website launched.";
var string_2:String = "New products added. Look for them in our products section";
var string_3:String = "Flash compatible now. Enjoy our website in any website supporting flash.";
var stringInterval = setInterval(writeIt,70);
var count:Number = 0;
function writeIt() {
textNews1.text = string_1.substring(0,count);
count++;
if(count > string_1.length) {
clearInterval(stringInterval);
}
textNews2.text = string_2.substring(0,count);
count++;
if(count > string_2.length) {
clearInterval(stringInterval);
}
textNews3.text = string_3.substring(0,count);
count++;
if(count > string_3.length) {
clearInterval(stringInterval);
}
}
stop();
I have created 3 dynamic text fields, each with the instance name textNews1, textNews2, and textNews3 respectively.
When I run the code, a small portion of the string values appear rather than the entire string… so say for instance for string_2, only the first 10 characters appear.
Why is this happening?
Thanks everyone!