
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
6 Responses to "Scripted Typewriter Effect" 
|
said this on 11 May 2007 5:05:27 AM CDT
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 CDT
Love the tutorial! Is the
|
|
said this on 04 Jun 2007 3:12:45 PM CDT
is there a way to get thi
|
|
said this on 20 Mar 2008 6:29:52 PM CDT
Thanks it worked beatiful
textbox = to textbox = substr |
|
said this on 30 Oct 2008 11:55:44 AM CDT
NICEEE THIS IS VERY HELPF
|
|
said this on 14 Jun 2009 3:24:54 PM CDT
Also, the speed of the te
just cha i t q++ To: if tex q+(q++)+(q++)+(q++) |


Author/Admin)