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 --> <BODY> <SCRIPT LANGUAGE=\"JavaScript\"> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin 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> <p><center> <font face=\"arial, helvetica\" size=\"-2\">Free JavaScripts provided<br> by <a href=\"http://javascriptsource.com\">The JavaScript Source</a></font> </center><p> <!-- Script Size: 0.63 KB --> ================= This is the code I am using for my Flash file <TD COLSPAN=15 ROWSPAN=8> <object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.ca 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 pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_ Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"631\" height=\"450\" bgcolor=\"#9999CC\"> </embed> </object></TD>
Digital Monk Date: 29/06/2001

hi, 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. pseudocode: frame 1: tmpVariable = randomize(Any number); frame 2: 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.
Carlito Date: 14/12/2001
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. Cheers.
Latouche Date: 03/06/2002
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.
Add comment
Home