By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,620 Members | 1,826 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,620 IT Pros & Developers. It's quick & easy.

Javascript to randomly load flash .swf

P: n/a
I have tried all of the solutions given by other members on how to load
a random .swf file on the load of the page, however, none of them seem
to work on my site. The problem is in embedding the random .swf in the
object tag of my code. Could someone please shed some light on this
issue for me because I'm clueless on this one?

Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies

P: n/a
Probably not the answer you want to hear in a JavaScript forum, but why
don't you try loading a Flash movie that loads other Flash movies into
itself randomly using ActionScript?

Jul 23 '05 #2

P: n/a
How do you use ActionScript to do this?

Jul 23 '05 #3

P: n/a
This is really quick and dirty, but try this:

Name all of your swfs with the same name plus a number. (ex.
movie1.swf, movie2.swf, movie3.swf, etc.)

Create another movie with one frame. Put this actionscript in the

var basename = "movie";
var totalmovies = 3;
var movietoload = basename +

Set basename equal to the basename of the swf files you're going to
load (in this example "movie") and set totalmovies equal to the number
of movies you have that can be loaded randomly.

That should do the trick and since it relies on the Flash player rather
than the browser, it'll be more cross-browser compatible.

Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.