|
||||||
|
||||||
Flash Tutorial - Generating Random Numbers

Free
Flash Tutorial
Step Three: Setting Up the Button ActionScript
Note: If you take a button from the Common Button Library avoid Knobs, Faders and Component buttons as they work differently.
Important Note: In the top left corner of the Actions Panel it must say: Actions - Button
If it does not say Actions - Button it can be for two reasons:
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
on (release) {
myDisplay = random (10) +1;
}
The ActionScript Explained:on (release) {
When the user releases the Mouse button what is between the curly braces ...
myDisplay = random (10) +1;
In this case the random function creates a random number that starts at 0 and ends on the 10th digit. Which is the number specified in the parentheses: (10). If you start your count from zero (instead of 1) then the 10th digit is 9 (not 10)! So to make it count form 1 to 10 I simply add one to the result. Hence the +1.}
The curly brace ends the on (release) statement.
|
Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates
•
7009 visitors to this page since
2 July 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.
|