[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Random loading of external swf file using loadMovie

Posted on 2005-04-08
18
Medium Priority
?
5,652 Views
Last Modified: 2012-08-14
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.
0
Comment
Question by:espressonow
  • 6
  • 5
  • 5
  • +1
18 Comments
 
LVL 8

Expert Comment

by:Cerf
ID: 13738307
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
 

Author Comment

by:espressonow
ID: 13738560
Tried adding stop(); to both movies with no success
0
 
LVL 8

Expert Comment

by:sokhodom
ID: 13739348
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:espressonow
ID: 13739534
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
 

Author Comment

by:espressonow
ID: 13739544
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
 
LVL 8

Expert Comment

by:sokhodom
ID: 13739568
Mind to post your fla here? Let's us look at it.
0
 
LVL 8

Expert Comment

by:Cerf
ID: 13739581
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
 
LVL 8

Expert Comment

by:Cerf
ID: 13739593
Posting your flas is a good idea.
0
 

Author Comment

by:espressonow
ID: 13739648
i apologize for my inexperience, but how do i post the files on this forum?
0
 
LVL 8

Expert Comment

by:sokhodom
ID: 13739703
unfortunately, you will need to post it on your own server and post the URL to here instead.
0
 
LVL 8

Assisted Solution

by:Cerf
Cerf earned 1000 total points
ID: 13739801
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
 
LVL 18

Expert Comment

by:Billystyx
ID: 13739832
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
 
LVL 8

Accepted Solution

by:
sokhodom earned 1000 total points
ID: 13739868
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
 
LVL 18

Expert Comment

by:Billystyx
ID: 13739933
(test the quote1 movie first or it wont show)

Billystyx
0
 

Author Comment

by:espressonow
ID: 13739938
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
 
LVL 8

Expert Comment

by:sokhodom
ID: 13739966
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
 
LVL 8

Expert Comment

by:Cerf
ID: 13739978
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question