PDA

View Full Version : random movie?


thejuve
03-22-2003, 01:21 AM
hi there!

Can anyone help me?

in a site at principal FLA i wanna put several movies, but randomless

how can I do that?


thanx!

CyanBlue
03-22-2003, 05:55 AM
Howdy and Welcome... ;)

I have got a question for you...

How do you load your external movie right now???

How many external movies do you have???

Do you know how to generate the random numbers in Flash???

;)

bluegel
03-22-2003, 02:38 PM
that's 3 questions CyanBlue! :) ,

but yep, can you give a bit more detail on what exactly you want to do, and we might be able to help you a little bit better.

thejuve
03-22-2003, 04:11 PM
hi, me again!

well, in a principal fla i've this in a timeline's first frame:

loadMovie("anim.swf", "_root.ventana.peli");

and it call me a second movie, this one I wanna change

how much?
maybe 3 or 5, depends

and I see a code to random but, sincerally I don't know

CyanBlue
03-23-2003, 02:40 AM
Okay... Try this code then... ;)// Define an array with the names of the SWF files
// you want to load dynamically...
swfArray = new Array("anim.swf", "a1.swf", "b3.swf",
"f2.swf", "h3.swf", "s6.swf");
// Get the length of the array and assign it to the variable...
maxMovie = swfArray.length;
// Get the random number between 0 to maxMovie...
rndNum = Math.floor(Math.random() * maxMovie);
// Get the random file name from the swfArray and
// do the loadMovie() into the specified target...
loadMovie(swfArray[rndNum], "_root.ventana.peli");Let me know...

farafiro
03-23-2003, 11:10 AM
also an easier way, decreases the lines by two, if the swfs goes in sequence (swf1, swf2,...)num = 5 //>total num of all swfs by 1
ranNum = Math.round(Math.random()*num)
loadMovie("swf"+ranNum+".swf",myHolder)

thejuve
03-24-2003, 03:09 PM
thanks guys, all works.


:)

LoneJeeper
07-11-2006, 02:28 PM
also an easier way, decreases the lines by two, if the swfs goes in sequence (swf1, swf2,...)num = 5 //>total num of all swfs by 1
ranNum = Math.round(Math.random()*num)
loadMovie("swf"+ranNum+".swf",myHolder)
ok, i see how this works... i'm familiar with early versions of flash and actionscript, but this Flash 8 stuff is different.

once I use the code above, how do i get the movie to play?

lj

farafiro
07-12-2006, 04:16 AM
what do u mean?? this will load one from five swf randomly into your holder MC