|
||||||
|
||||||
Flash Tutorial - The Matrix Special Effects
Free
Flash Tutorial
Step Two: Creating Random Characters
In this example I will create a single Movie Clip that will generate random characters generated with ActionScript.
Note: If you did not want random characters but wanted a specific set of characters like: A, B & C you would create three Movie Clips each with one of the specified letters. You would then leave out the ActionScript that generates the random characters as described at the end of this step.
Note: In fact it is not necessary to type anything in the text box as random letters will be assigned via the ActionScript. I just find text boxes are easier to manage if they have something typed in them. The letter makes it easier to see what you are doing.
The text is set to Dynamic Text and has a Variable Name (not an Instance Name):
Your Property Inspector should look similar to this.
Your Text Box should now be dead centre of the Stage:
Note: With Script Assist on you cannot type in the Actions Panel. If you want to learn more about Script Assist see the tutorial on the Actions Panel
x = random (255);
this.myLetter = chr (x) ;
The ActionScript Explained: The random(255) function will generate a number between 0 and 255 in a random order. The chr(x) is used to convert the number into the corresponding ASCII character (letters, numbers & symbols). This random generation of characters is what then sent to the text box called letter which is what you just created.
|
Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates
•
15862 visitors to this page since
11 May 07 •
|
|
|
All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.
|