Jump to content

random number on a button press


Recommended Posts

// Ive created an array with three items.Button named random btn is to give the result of a random number of one, two, three. // Now the result after the button is pressed is only selecting one random number out of the three. Then the button is repeats the result each time the button is pressed.as an example say the number one is chosen number one. Press the random btn and thats the only number which is choosen.var targetArray:Array = new Array("one", "two", "three");// this makes a random numbervar randomNum = random(targetArray.length);randomBtn.onPress = function(){trace(randomNum);}hansolo is online now Report Post Edit/Delete Message

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...