dimanche 31 mai 2015

categorize arrays AS3

I've got this array :

var usersArray:Array = new Array("this is array1 and it's a good array","this is array2", "this is array3", "this is array4", "this is array");
usersArray.push(usersArray.splice(usersArray.indexOf("UserID"), 1));

var companion:String = usersArray[Math.floor(Math.random() * (usersArray.length - 1))];


Is it possible to class the array with letter or number as my array could be very long ?


if (companion==A){
trace("this is array 1")

Instead of

if (companion=="this is array1 and it's a good array"){
trace("this is array 1")

Thanks !

Aucun commentaire:

Enregistrer un commentaire