wat is the action script if:
I have 16 different pictures that are suppose to appear randomly (10 at a time) when the page loads.
which means each time the page load, there will be 10 pictures in it, without repetition.
pls help… tq (-:
wat is the action script if:
I have 16 different pictures that are suppose to appear randomly (10 at a time) when the page loads.
which means each time the page load, there will be 10 pictures in it, without repetition.
pls help… tq (-:
http://www.kirupa.com/developer/mx/loadingrandombackground.htm
perhaps this will help;)
pictures_array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
Array.prototype.pickRandomValues = function(n) {
var selected = [];
for (var i = 0; i<n; ++i) {
var r = Math.floor(Math.random()*this.length);
selected.push(this[r]);
this.splice(r, 1);
}
return selected;
};
//this will return 10 random values out of the pictures_array
trace(pictures_array.pickRandomValues(10));
:: Copyright KIRUPA 2024 //--