Random Number Generator
Hi there,
I'm totally new to ActionScript 3 and just trying some very simple things to try to understand how it works in Flash CS5. I have no-one mentoring me so these forums are my first port of call. I wanted to create a simple random number generator. Very simple. Click on a button (first_50) that displays a random number in a text box (main_balls.text) set to Classic/Dynamic. The script I have is as follows:
first_50.addEventListener(MouseEvent.CLICK, firstFiftyGenerator);
function firstFiftyGenerator(limit:Number):Number
{
var randomNumber:Number = Math.floor(Math.random()*(limit+1));
return randomNumber;
}
main_balls.text = String(firstFiftyGenerator(50));
I get no errors in the compiler and my button works in runtime. I just don't get a number in my text box when I click on it. Can anyone help?
KR,
Th9nker
