Help with Random Image Generator
summary: made flash movie 'container' randomly load images i've uploaded on webspace. images named "image1.jpg" , "image1blur.jpg" , forth (the blur files used smooth transitions.
so in first frame of movie, define maximum number of images:
------------------------------------
imageframes = 86;
rand = math.floor(math.random() * imageframes) + 1;
it = rand;
------------------------------------
sure enough, first image that's loaded container random image #1 #86, after that, image incremented, whereas want random image loaded every time. please take @ actionscript , tell me how can go doing this?
here's code second frame:
------------------------------------
it += 1;
if (_root.maxpics == undefined) {
_root.maxpics = imageframes;
}
if (it > _root.maxpics) {
-= 1;
d = 1;
while (d < it) {
swapname2 = eval(("swap" + d));
swapname2.removemovieclip();
d++;
}
swapname3 = eval(("swap" + it));
swapname3.swapdepths(depths);
= 1;
}
this.attachmovie("swapx", ("swap" + it), it);
swapname = eval(("swap" + it));
swapname.image = (" http://users.tpg.com.au/gbae/image" + it) + ".jpg";
swapname.imageblur = (" http://users.tpg.com.au/gbae/image" + it) + "blur.jpg";
------------------------------------
my flash file can found @ http://users.tpg.com.au/gbae/xanga logo.fla
thanks in advance can offer.
so in first frame of movie, define maximum number of images:
------------------------------------
imageframes = 86;
rand = math.floor(math.random() * imageframes) + 1;
it = rand;
------------------------------------
sure enough, first image that's loaded container random image #1 #86, after that, image incremented, whereas want random image loaded every time. please take @ actionscript , tell me how can go doing this?
here's code second frame:
------------------------------------
it += 1;
if (_root.maxpics == undefined) {
_root.maxpics = imageframes;
}
if (it > _root.maxpics) {
-= 1;
d = 1;
while (d < it) {
swapname2 = eval(("swap" + d));
swapname2.removemovieclip();
d++;
}
swapname3 = eval(("swap" + it));
swapname3.swapdepths(depths);
= 1;
}
this.attachmovie("swapx", ("swap" + it), it);
swapname = eval(("swap" + it));
swapname.image = (" http://users.tpg.com.au/gbae/image" + it) + ".jpg";
swapname.imageblur = (" http://users.tpg.com.au/gbae/image" + it) + "blur.jpg";
------------------------------------
my flash file can found @ http://users.tpg.com.au/gbae/xanga logo.fla
thanks in advance can offer.
your variable "it" incremented in frame 2 (and not random number). if frame 2 repeatedly executes you're going load images in incremental order.
and why using attachmovie() , using attached movieclips targets of loadmovie()?
and why using attachmovie() , using attached movieclips targets of loadmovie()?
More discussions in ActionScript 1 and 2
adobe
Comments
Post a Comment