as2 question
- Started
- Last post
- 3 Responses
- itstimefortea
Hi...
I'm working on a flash file where I'm loading external swfs into a blank movie clip. I found some script in a tutorial which allows you to load them randomly from an array... BUT the odd time it repeats the same swf twice in a row. I've included my code below... if there's an easy way to avoid this duplication I'd really appreciate any help.
Cheers :)
var images = ["IMAGE1.swf","IMAGE2.swf","IMAG...
function extractRandom(arr:Array,num:Numb...
var rn:Number;
var arrCopy:Array = arr.concat();
var output:Array = new Array();
for(var i=0;i<num;i++){
output[i] = arrCopy[rn=random(arrCopy.length...
arrCopy.splice(rn,1);
}
return output;
}
var randomImages:Array = extractRandom(images,1);
movie.loadMovie(randomImages[0...
- itstimefortea0
dunno why the code doesn't paste in properly
I'll try again:
var images = ["IMAGE1.swf","IMAGE2.swf","IMAG...
function extractRandom(arr:Array,num:Numb...
var rn:Number;
var arrCopy:Array = arr.concat();
var output:Array = new Array();
for(var i=0;i<num;i++){
output[i] = arrCopy[rn=random(arrCopy.length...
arrCopy.splice(rn,1);
}
return output;
}
var randomImages:Array = extractRandom(images,1);
movie.loadMovie(randomImages[0...
- mikotondria30
you need the hack for array.shuffle();