Random loading of external swf file using loadMovie

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);
loadMovie(path+filename[k], MovieTarget1);

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.
espressonowAsked:
Who is Participating?
 
sokhodomConnect With a Mentor Commented:
espressnow,
1-open quote1.fla,
2-on layer1, frame 72, click on the Black Dot and open up actionscript panel(F9)
3- put the code stop();

Test the main movie,

0
 
CerfCommented:
Hello espressonow,

I suggest you try adding a stop(); in the last frame of quote1.swf, quote2.sfw and so on.
You might need to use a stop(); in the main movie too.

Cërf.

0
 
espressonowAuthor Commented:
Tried adding stop(); to both movies with no success
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
sokhodomCommented:
espressonow,
Inside your two Movies (quote1 and quote2), is there any more Movies embeded inside? If yes, also put a stop; in those movies as well.
Stop; would do the task,
0
 
espressonowAuthor Commented:
The external movies have three layers, 2 with motion tweening, and one with the backgroud image.  I have tried putting a "stop();" command on every layer of both the main.swf and the loaded movie with no success.
0
 
espressonowAuthor Commented:
after looking into this more - i am wondering if there is a javascript to insert in the html code to randomly call a movie, instead of using a movie to load another movie
0
 
sokhodomCommented:
Mind to post your fla here? Let's us look at it.
0
 
CerfCommented:
Hm,
The stop(); *SHOULD* work...

The thing is,
If the main movie loops then the loaded movies probably will seem to loop, even if they are not actually looping themselves.
0
 
CerfCommented:
Posting your flas is a good idea.
0
 
espressonowAuthor Commented:
i apologize for my inexperience, but how do i post the files on this forum?
0
 
sokhodomCommented:
unfortunately, you will need to post it on your own server and post the URL to here instead.
0
 
espressonowAuthor Commented:
0
 
CerfConnect With a Mentor Commented:
Ok, here's what you have to do...
Open Quote1.fla
click on the layer called "Layer10" or create a new one on top.
go to frame 72, create a blank keframe (F7) open the actions frame (F9) and write stop();

Hit CTRL ENTER
and run main.swf...
Should be working as you wanted.

Cërf.
0
 
BillystyxCommented:
putting a stop on the last frame of the quote1.swf will do it - make sure you have it in a seaprate keframe on the very last frame of that main time line, test run it and then go back to your main swf and test that too. It will play once and stop at the end

Billystyx
0
 
BillystyxCommented:
(test the quote1 movie first or it wont show)

Billystyx
0
 
espressonowAuthor Commented:
thank you Cerf & sokhodom worked perfectly - i dont know what i was doing work with the stop command.  Can i split the points between you two?
0
 
sokhodomCommented:
You are welcome espressonow,
Yes you could. Scroll all the way down and there is a word said "split". Click on it and Assign points respectively.
0
 
CerfCommented:
Distribute the points as you think is fair, I have no problem with whatever your decision might be...

Glad I could help,

Cërf.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.