Jump to content

random number on a button press


hansolo

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...