Random loading of external swf file using loadMovie
Posted on 2005-04-08
I am using loadMovie to randomly load an external swf file into a main movie file. Think of random banner ads. Here is my actionscript code.
filename = ["quote1.swf", "quote2.swf"];
path = "";
i = filename.length;
k = Math.floor(Math.random()*i);
In the end there will be many more then 2 files to choose from, but this is just to test it. The main movie, main.swf, is embedded into an html page and the code works fine with one exception - the movie that is loaded continues to loop. For instance if "quote1.swf" is loaded it will continue to loop. I want the movie to play once and stop on the last frame. I have tried to control it using the loop= "false" parameter in the HTML code. If I load the file "quote1.swf" directly into the web page it does not loop, so i know it is a problem with the loadMovie function i have used.
To further clarify: main.swf has nothing in it except a single frame with a symbol on it called "MoveTarget1" with the actionscript that calls the external movie.