I am trying to make a code that includes a list of names (probably in an array I think) and displays one name in an input text field.
I’m still learning al of this so maby someone can change this code a little bit so it works:
Hi,
Or you could do it this way
[AS]
namesArr = new Array();
namesArr = [“Fred”,“Kato”,“Mike”,“John”,“Kax”,“Cyrus”,“Susan”,“Jane”,“Amanda”,“Helen”,“Denise”];
for(i=1;i<namesArr.length;i++){
inputTextField.text = namesArr[Number(random(i))];
}[/AS]
he above works well, but I think kax’s inclusion of Math.random may make it more efficient.
SteveD
Creating engaging and entertaining content for designers and developers since 1998.