all groups > flash actionscript > july 2006 >
You're in the

flash actionscript

group:

Write on text effect help please?!


Write on text effect help please?! maffpunton
7/30/2006 3:54:07 PM
flash actionscript:
Hi!

I'm doing my own version of a write-on text effect from a tutorial I found.

I am having flash "type" out ten lines of text (all formatted differently) so
have had to split the text up into different dynamic text fields and give them
different instance names (text1, text2... text10)

I have written the code so that the lines write out one after the other,
however, I'm finding that the rate at which they write out speeds up as it goes
through the animation. I was hoping someone could explain why to me and offer a
solution please? I'm a newbie. Also, if anyone knows of any ways of doing this
without all these lines of code I'd be very grateful.

Thanks.
:confused;

var sInt1 = setInterval (write1,100);
var count1:Number = 0;
function write1() {
text1.text = str1.substring(0,count1);
count1++;
if (count1 > str1.length) {
clearInterval(sInt1);
var sInt2 = setInterval (write2,100);
}
}

var count2:Number = 0;
function write2() {
text2.text = str2.substring(0,count2);
count2++;
if (count2 > str2.length) {
clearInterval(sInt2);
var sInt3 = setInterval (write3,100)
}
}

var count3:Number = 0;
function write3() {
text3.text = str3.substring(0,count3);
count3++;
if (count3 > str3.length) {
clearInterval(sInt3);
var sInt4 = setInterval (write4,100);
}
}

//...etc etc... all the way to text10...
Re: Write on text effect help please?! kglad
7/30/2006 4:27:03 PM
try:



tl = this;
sInt1 = setInterval(writeF, 100, 1);
var count:Number = 0;
function writeF(n) {
tl["text"+n].text = tl["str"+n].substring(0, count);
count++;
if (count>tl["str"+n].length) {
clearInterval(tl["sInt"+n]);
n++;
if (n<=10) {
count = 0;
tl["sInt"+n] = setInterval(writeF, 100, n);
}
}
}
Re: Write on text effect help please?! maffpunton
7/30/2006 4:37:05 PM
Re: Write on text effect help please?! kglad
7/30/2006 4:49:11 PM
AddThis Social Bookmark Button