Flash Script – Random Text Effect With Default Text Display

Share this article


It looks cool… and it’s easy! Here’s what you need to create your own random text effect.

1. Create a text field and name it. I gave mine a variable name of "shuffle".

2. Convert the textfield to a movie clip, and name it "Random".

3. Right click the movie clip and access its actions. Insert the following action:

onClipEvent (enterFrame)  
{
if(!_root.flag)
{
shuffle = chr(random(26)+65);
}
}

4. Create 4 duplicates of the movie clip.

I want the RandomText movie clip to display Flash, then pause for a moment, then continue. There are 5 letters in the word "flash", so I’ll use 5 movieclips.

5. Select the first movieclip and give it an instance name of "t1"; name the second one t2, and so on for the other movieclips.

6. Name the current layer "text", extend it three keyframes, then lock the layer.

7. Create a new layer above the text layer, and name it "actions". Create three blank keyframes in this layer. In the first keyframe, insert this action:

i = 0 
flag = 0
lapse = 20;
display = 10;

8. In the second keyframe, insert this code:

i = i + 1 
if(i > display)
{
flag = 1;
_root.t1.shuffle = "F";
_root.t2.shuffle = "L";
_root.t3.shuffle = "A";
_root.t4.shuffle = "S";
_root.t5.shuffle = "H";
}
if(i > lapse)
{
flag = 0;
i = 0;
}

9. In the third keyframe, insert this action:

gotoAndPlay (2);

10. That’s it! Run the movie, and you’ll see the effect above.

Georgina LaidlawGeorgina Laidlaw
View Author

Georgina has more than fifteen years' experience writing and editing for web, print and voice. With a background in marketing and a passion for words, the time Georgina spent with companies like Sausage Software and sitepoint.com cemented her lasting interest in the media, persuasion, and communications culture.

Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week