filename = ["filename","filename"];
path = "http://www.domain.com/swf/";
i = filename.length
k = Math.floor(Math.random()*i);
loadMovie(path+filename[k], MC_box);
what did i write.... i dont know. lets go through it.
this script should be in a MAIN swf that all the other swfs get loaded into.
filename = ["filename","filename"]; - "filename =" this is a variable that we came up with. ["filename","filename"] <-- [ ] this means that you just made an ARRAY and entered the stuff in the middle into that array. (hope that makes sense). ; closes off that script
path = "url"; - "path =" is a variable that we made up again. "url" should be the folder path.
i = filename.length; = i is a variable containing a number. the number is the length (how many items) in the filename array. since i wrote 2, then i = 2;
k = Math.floor(Math.random()*i); = k is a variable also containing a number, but this time its random. we are using Math.floor() and Math.random() to help us choose a number randomly (WITHIN THE ARRAY).
loadMovie(path+filename[k], MC_box); = loadMovie() is a command in flash to load movie file. path+filename[k] <-- this is our 2 variables put together forming a path [k] is the random number. this is choicing the filename in the array. for more information. look up arrays... MC_box is just a movie clip i named in this flash movie. its an empty container.
No comments:
Post a Comment