
Page 1 of 1
Daniel Skovli
This user is yet to take control of their account and provide a biography. If you are the author of this article, please contact us via support AT actionscript DOT org.
View all articles by Daniel SkovliTime: 10 minutes
Difficulty Level: Beginner
Requirements: Flash 5 or above
Topics Covered: How to create a quick and easy typewriter effect, which supports limited formatting.
Assumed knowledge: Variables, String manipulation.
Download the Source file for this tutorial (zipped .fla, flash 5)
You have probably seen many different typewriter effects done in flash. So have I, but there was one I couldn't find - the pure actionscript typewriter. Therefore, I've written this tutorial. Follow these easy steps, and you'll have your own typewriter done in no-time:
Step 1 - Creating the layout and frames:

As you might have spotted from this screenshot - you need three frames to build your typewriter. I have put actions, buttons and text in separate layers, but that is just for structure. Make a dynamic text-box, and give it the variable name 'textbox'. This should go over all three frames.
Step 2 - creating the frame-actions:
Then, you are ready to create the actions to make the whole thing work:
o In Frame 1 we define the text we want to display. Use "\n" for a newline. Frame 1 has these actions
q = 1;
text = "this is where you put your text";
stop();
o Frame 2 checks if we've output all the characters yet, and if not it takes Q characters from the start of our string and shows them in the text field. Frame 2 has these actions:
if (q < text.length) {
textbox = text.substring(0, q);
q++
} else {
textbox = text;
gotoAndStop(1);
}
o Frame 3 is just a loop back frame. Frame 3 has these actions:
gotoAndPlay(2);
Step 3 - creating the button:
Make a button at frame 1, and place it on stage. This button should launch the typewriter, so it has to have a little piece of code attached to itself (right click the button, and chose actions).
o the button has these actions:
on (release) {
play();
}
Spread The Word
Related Articles
14 Responses to "Scripted Typewriter Effect" 
|
said this on 11 May 2007 5:05:27 AM CST
you can also implement th
this.createEmpt typewriter.onEnterFram //call substring funct //once q is g call: delete typewri } |
|
said this on 22 May 2007 9:58:56 AM CST
Love the tutorial! Is the
|
|
said this on 04 Jun 2007 3:12:45 PM CST
is there a way to get thi
|
|
said this on 20 Mar 2008 6:29:52 PM CST
Thanks it worked beatiful
textbox = to textbox = substr |
|
said this on 30 Oct 2008 11:55:44 AM CST
NICEEE THIS IS VERY HELPF
|
|
said this on 14 Jun 2009 3:24:54 PM CST
Also, the speed of the te
just cha i t q++ To: if tex q+(q++)+(q++)+(q++) |
|
said this on 09 Jul 2009 5:44:03 AM CST
Not working anymore.
def var q = 0; and its t |
|
said this on 30 Jul 2009 4:19:35 PM CST
Make sure to embed the fo
|
|
said this on 04 Aug 2009 12:37:33 PM CST
Hi this looks like exactl
If I t |
|
said this on 05 Aug 2009 1:37:54 AM CST
OK found out how to attac
Only p I have set textbox to |
|
said this on 10 Aug 2009 11:02:47 AM CST
set your textbox to "mult
|
|
said this on 15 Oct 2009 6:30:20 PM CST
how do I make it stop whe
I got rid o |
|
said this on 18 Nov 2009 5:34:58 AM CST
Thank you very much!!! Th
|
|
said this on 17 Feb 2010 7:04:46 AM CST
Great Tutorial!
It is |


Author/Admin)