Web
Article

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

No Reader comments

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Instant Website Review

Use Woorank to analyze and optimize your website to improve your website to improve your ranking!

Run a review to see how your site can improve across 70+ metrics!

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