Displaying a random picture, movie, background
Simply provide all your pictures in a movieobject one in each frame.
Place a stop-action in the first frame of this movieobject. Place
this movie object where you like and name it "randompicture".
Then you can use this script to select a random picture.
randompicture.gotoAndStop(random(randompicture._totalframes - 1) + 1);
Macromedia has defined the function random() as deprecated, so
in future it is better to use the following:
randompicture.gotoAndStop(Math.floor(Math.random() * randompicture._totalframes) + 1);
- Dionne Date: 08/06/2001
Is there a way to rotate a different flash movie every week? For instance
if I have a swf file imbedded and I wanna change it every week? How can I
do that? Each file will have the same size/dimensions ... I need pasted a
script for swaping an image .. maybe some of you script gurus can help me
modify it for Flash.
<!-- ONE STEP TO INSTALL WEEK DAY IMAGE:
1. Copy the coding into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the BODY of your HTML document -->
<!-- This script and many more are available free online at -->
today = new Date();
day = today.getDay();
arday = new Array(\"sunday.jpg\", \"monday.jpg\", \"tuesday.jpg\",
\"wednesday.jpg\", \"thursday.jpg\", \"friday.jpg\", \"saturday.jpg\");
document.write(\"<img src=\'\" + arday[day] + \"\'>\");
// End -->
<!-- Script Size: 0.63 KB -->
This is the code I am using for my Flash file
<TD COLSPAN=15 ROWSPAN=8> <object
b#version=4,0,2,0\" width=\"631\" height=\"450\">
<param name=movie value=\"currentissue.swf\">
<param name=quality value=high>
<param name=\"BGCOLOR\" value=\"#9999CC\">
<embed src=\"currentissue.swf\" quality=high
Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"631\"
- Digital Monk Date: 29/06/2001
hrm, i was thinking of randomizing yer movie via randomizing a variable on your first frame and then based the loading movie from the random value ... might work.
tmpVariable = randomize(Any number);
gotoAndPlay(tmpVariable + 2); // + 2 to avoid the two frames with actionscript
• note however that if ur seed value is 10 then you should have a loadMovie on every frame (that is frame 3) up to 10th frame.
--- sorry if i had a bad english, it\'s not my first language.
Anyone know how to 'shuffle' an array?
eg. myArray = "movie1.swf", "movie2.swf", "movie3.swf", etc.
I want to somehow use myArray.sort(randomFunction); to 'shuffle' the load order of the movies in the array.
- Carlito Date: 14/12/2001
Hi bokel, great ActionScript !
This is very interresting for a newbie like me, I'm using this code to rotate advertising banner on my site. And it works great ! Long live BOKEL !!! :)
- Latouche Date: 03/06/2002
...and of course you could place animations instead of simple images in the ''randompicture'' MovieClips, so it will rotate images and/or MovieClips. Excellent technique if you want to advertise many products in a single page.
- Latouche Date: 03/06/2002