Flash Quick Tip: How to randomize an Array

Posted in Flash | 2 Comments
I had to google this today so i though i would share it with you! This snippet of actionscript can be used to simply re-order or randomize an array in Adobe Flash.
var myArray = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9);
myArray.sort(function (){
return Math.round(Math.random());
});
trace(myArray);
ps and yes i know I’ve spelt randomise wrong ; ) Tags: