Heres a few helpful bits or flash actionscript code to help you on your way with developing dynamic flash content.
Random Number
There are a few ways to generate a random number in flash it all depends on what you need and how your going to do things, heres some examples:
Generate a random number between 0 and 10
variable = Math.random()*10;
Result: variable = 7.967452
Rounding a Random Number
variable = Math.floor(Math.random()*10);
Result: variable = 7
Random Number (Between specific numbers 10-20)
variable = Math.floor(Math.random()*(20-10+1))+10;
Result: variable = 15
Useful Key ASCII/ALT Codes
|
ENTER |
13 |
|
BACKSPACE |
8 |
|
0 |
48 |
|
1 |
49 |
|
2 |
50 |
|
3 |
51 |
|
4 |
52 |
|
5 |
53 |
|
6 |
54 |
|
7 |
55 |
|
8 |
56 |
|
9 |
57 |