Flash Actionscript Goodies

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

Advertisements

About Saran

Hello there!!! I'm Saravanan, born and living in India. The main reason i decided to start this project it was because there should be a way to transfer my knowledge which i experimented in flash to all. i try to concentrate as much as possible all kind of issues can appear to someone is developing an Flash application. If you need help, or if you would like to see in this blog some issues, send me an e-mail to rksaran@rediffmail.com Follow Me: twitter:http://twitter.com/rksaran Best Regards, SRK
This entry was posted in AS3, Flash. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s