# Typewriter Effect From A Text File

**URL:** <https://forum.kirupa.com/t/typewriter-effect-from-a-text-file/64830>\
**Category:** flash\
**Created:** [September 20, 2004, 4:19pm UTC](https://forum.kirupa.com/t/typewriter-effect-from-a-text-file/64830 "2004-09-20T16:19:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nessie](https://avatars.discourse-cdn.com/v4/letter/n/e274bd/32.png) [@nessie](https://forum.kirupa.com/u/nessie)\
**Post date:** [September 20, 2004, 4:19pm UTC](https://forum.kirupa.com/t/typewriter-effect-from-a-text-file/64830/1 "2004-09-20T16:19:21Z")

</div>

Typewriter Effect From A Text File is ther any on ho knows??

/M

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 20, 2004, 6:03pm UTC](https://forum.kirupa.com/t/typewriter-effect-from-a-text-file/64830/2 "2004-09-20T18:03:26Z")

</div>

this is off the top of my head but it should work.It works from a string NOT a text file but that should be easy enough to change. Just copy and paste this on the first keyframe of a new flash FLA.  
then test movie.  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
var test:String = “hello this is a typing test.”;  
var testTwo = test.split("");  
for (var i = 0; i\<testTwo.length; i++) {  
this.createEmptyMovieClip(“text”+i, this.getNextHighestDepth());  
\_root[“text”+i].createTextField(“txt”, 1, 5, 5, 20, 20);  
\_root[“text”+i].txt.text = testTwo\*;  
\_root[“text”+i].\_x = \_root[“text”+i].\_x+10\*i;  
\_root[“text”+i].\_visible = false;  
}  
var x = setInterval(fade, 200);  
cnt = 0;  
function fade() {  
\_root[“text”+cnt].\_visible = true;  
cnt++;  
}

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
hope this helps

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 20, 2004, 6:18pm UTC](https://forum.kirupa.com/t/typewriter-effect-from-a-text-file/64830/3 "2004-09-20T18:18:13Z")

</div>

revision  
oops… did not have flash running when I submitted first response.

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
var test:String = “hello this is a typing test.”;  
var testTwo = test.split(“”);  
for (var i = 0; i\<testTwo.length; i++) {  
this.createEmptyMovieClip(“text”+i, this.getNextHighestDepth());  
\_root[“text”+i].createTextField(“txt”, 1, 5, 5, 20, 20);  
\_root[“text”+i].txt.text = testTwo\*;  
\_root[“text”+i].\_x = \_root[“text”+i].\_x+10\*i;  
\_root[“text”+i].\_visible = false;  
}  
var x = setInterval(fade, 200, testTwo.length);  
cnt = 0;  
function fade(z) {  
if (cnt\<z) {  
\_root[“text”+cnt].\_visible = true;  
} else {  
clearInterval(x);  
}  
cnt++;  
}  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

> [@nessie](#):
>
> Typewriter Effect From A Text File is ther any on ho knows??
> 
> /M

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 21, 2004, 9:48am UTC](https://forum.kirupa.com/t/typewriter-effect-from-a-text-file/64830/4 "2004-09-21T09:48:10Z")

</div>

thanks you but this isent a exturnal file.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 21, 2004, 3:57pm UTC](https://forum.kirupa.com/t/typewriter-effect-from-a-text-file/64830/5 "2004-09-21T15:57:52Z")

</div>

What ipaqflash was saying was you can use his method that he just posted, and you can modify it to use an external file. What will probably work is if you have a movie clip (box) that you’re loading your text into, get the actionscript to take the text that it’s loading and turn it into a string which would then work in the above code.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 21, 2004, 11:33pm UTC](https://forum.kirupa.com/t/typewriter-effect-from-a-text-file/64830/6 "2004-09-21T23:33:07Z")

</div>

theREAL–thx  
nessie theREal id correct  
load any text/xml–or mc (box) [theREal]  
make a string  
and u should b cool  
hope this helps  
thx again theREal

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 22, 2004, 10:47am UTC](https://forum.kirupa.com/t/typewriter-effect-from-a-text-file/64830/7 "2004-09-22T10:47:20Z")

</div>

Thanks TheRealAlan. The problen is that i´m no god at this so if you have the time i would be more then happy if you could help me with a .fla file that i could learn from.

Thanks!

/m

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 22, 2004, 8:42pm UTC](https://forum.kirupa.com/t/typewriter-effect-from-a-text-file/64830/8 "2004-09-22T20:42:28Z")

</div>

well i’ve been working with this for a little while now and i’m having a bit of trouble with it. I can’t get the dynamic text to load. The code that ipaqflash posted works perfectly on its own, but when i try to load the dynamic text into that string it’s just blank. I’ve never worked with externally loaded text files though so i’m probably doing something wrong. Can anyone please give me the proper code for loading a text file in as a string? I know you make a variable in the text file, but in AS, how do I get to that? Thanks.
