Flash random image
- Started
- Last post
- 18 Responses
- ********
I'm pulling random jpgs (named 1.jpg, 2.jpg, etc) from an external folder like this:
r=random(25)+1;
filename=r+".jpg";
loadMovie("pics/"+filename, _root.pic);is there a simple way to not repeat any of the images? Thanks
- fusionpixel0
yeah, each randon image your randomizer creates put it on a array so now compare to the array before loading the image, if the image is not in the array list, then load it, if not create another random number.
capish?
- ********0
I capish, but lack sufficient knowledge to implement. thanks, though.
- ********0
capisce
- ********0
with melon
- ********0
con il melone
- unfittoprint0
n = 25;
//REFRESH
function refresh(n) {
images = new Array();
for (i=0; i < n; i++) {
images[i] = (i+1)+".jpg";
}
randimages = new Array();
}
//EVENTS
trigger.onPress = function() {
rand = Math.floor(Math.random()*images...
_root.pic.loadMovie("pics/"+imag...
//backup
randimages.push(images[rand]);
//remove image
images.splice(rand, 1);
//RESTART
if (images.length == 0) {
refresh(n);
}
};
//START
refresh(25);
- ********0
stampare!
- ********0
thank you, sir
- personalityson0
an array of 1..25 is tossed, image display as you walk trough the array
- ********0
if I wanted that to be a frame action how would that change?
- ********0
(in unfit's reply)
- ********0
//
- unfittoprint0
//number of images
n = 25;//REFRESH
function refresh(n) {
images = new Array();
for (i=0; i < n; i++) {
images[i] = (i+1)+".jpg";
}
randimages = new Array();
}//Make Rand
function makeRand() {
if (images.length == 0 || images == undefined) {
refresh(n);
}
rand = Math.floor(Math.random()*images...
_root.pic.loadMovie("pics/"+imag...
//Backup
randimages.push(images[rand]);
//remove image
images.splice(rand, 1);
//Restart/Refresh
}
//usage for button
trigger.onPress = function() {
makeRand(n);
};
//or usage for frame
makeRand(n);
- ********0
I bow before you
shine on
- CyBrainX0
Was that function makeRand a reference to Random or Rand, the person?
Nice code unfit, (as usual). I'm saving that one.
- taragee0
fo real unfit should make a cd!
- ********0
he he-- that mp3 was actually singing, "fuck you, rand you code leach"
- unfittoprint0
Lisbon on heroin.