Flash Script – Random Text Effect With Default Text Display

By Georgina Laidlaw
We teamed up with SiteGround
To bring you up to 65% off web hosting, plus free access to the entire SitePoint Premium library (worth $99). Get SiteGround + SitePoint Premium Now


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.

The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
We teamed up with SiteGround
To bring you up to 65% off web hosting, plus free access to the entire SitePoint Premium library (worth $99). Get SiteGround + SitePoint Premium Now
Login or Create Account to Comment
Login Create Account