Flash Script – Random Text Effect With Default Text Display

By Georgina Laidlaw

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)  
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.

Free Guide:

7 Habits of Successful CTOs

"What makes a great CTO?" Engineering skills? Business savvy? An innate tendency to channel a mythical creature (ahem, unicorn)? All of the above? Discover the top traits of the most successful CTOs in this free guide.

No Reader comments

Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in Front-end, once a week, for free.