PDA

View Full Version : Need help on randomizing movie file on browser reload.



ethancote
April 18th, 2002, 04:17 PM
Hello all,

I'm a newbie at programming and had performed serveral search on the net without much useful results. For all you programmer guru out there, please lend me a hand if you can.

I am using flash version 5.0. I have 7 flash movie files within one working flash file and only 4 movie files gets display on an HTML page at a time. I need a script that will randomize the appearance of the movie files each time the browser gets refresh. But the script should only randomize 2 of the 4 movie files.

So for example, say I have movie files named 1 to 7. On browser load, I have movie file, 1,2,3 and 4 displayed. Now when a user refresh browser, I want movie file, 1 and 4 to be replaced by either movie file 5,6, or 7 (ie. random diplay of file)

This might sounds confusing or I might not be explaining it well, but if you go to www.standpipe.com (http://www.standpipe.com) you will see what I mean. Look at the Case studies section, there are 4 movie files being displayed.

Much, much, much thanks for any help provided.

Script can be sent to: chi@standpipe.com (if u wish).


Sincerely,

Chi Huynh

suprabeener
April 18th, 2002, 04:58 PM
here's a quick and simple method.

make one big flash movie which will contain the four randomly loaded movies.

make an empty movie. put four copies of it on the stage corresponding to where you want the loaded movies to be.

name them "targ0" "targ1" "targ2" "targ3"

in frame one put this code, where mcArray contains the names of the swfs you want to load:




mcArray = ["m1.swf","m2","m3","m4","m5","m6","m7"];



for(j=0;j<4;j++){

var r = random(mcArray.length);

loadMovie(mcArray[r],"targ"+i);

mcArray.splice(r,1);

}
there you go. totally untested, but the theory is sound. ; )

I am not Jubba
April 18th, 2002, 05:53 PM
there is also a post in the Best of Kirupa.com Forum that explains how to do this. you might try that too.

ethancote
April 19th, 2002, 04:36 PM
Geez, thanks guys for the help.

Honestly I didn't think I will get any response back so soon =)

I do not know much about scripting but I will give it a try.

Have a great day.