Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6009535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:59:04+00:00 2026-05-23T01:59:04+00:00

I need a Javascript or Ajax to load SWF files in a folder. /swfdir

  • 0

I need a Javascript or Ajax to load SWF files in a folder.

/swfdir
 |_ test_1.swf
 |_ test_2.swf
 |_ test_3.swf
 .
 .
 .
 |_ test_50.swf

A folder has number of swf files. I want load all of them one by one, by replacing existing one. each flash should play for 10 secs, then it must be replaced with next swf file.

Please provide me a working snippet.

UPDATE:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
        <title>SWFObject 2 static publishing example page</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <script type="text/javascript" src="swfobject.js"></script>
        <script type="text/javascript">
            function loadSWFObjects() {
                var i=1;
                for(i=1;i<=50;i++) {
                    document.getElementById("mySWF").innerHTML = 
                        "<object type=\"application/x-shockwave-flash\" data=\"SWFObjects/test_"i".swf\" width=\"300\" height=\"120\">";
                }
            }
        </script>
    </head>
    <body>
        <div>   
            <object id="mySWF" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="120">
                <object type="application/x-shockwave-flash" data="SWFObjects/test_1.swf" width="300" height="120">
            </object>
        </div>
    </body>
</html>

How to call that function after loading the page? This code is not working for me 🙁

Any help indeed.

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:59:05+00:00Added an answer on May 23, 2026 at 1:59 am

    At a minimum, your code isn’t working because you have a syntax error here — you’re not concatenating your “i” value:

    document.getElementById("mySWF").innerHTML = 
                            "<object type=\"application/x-shockwave-flash\" data=\"SWFObjects/test_"i".swf\" width=\"300\" height=\"120\">";
    

    It should be like this:

    .../test_" + i + ".swf...
    

    Given your requirement, you’d be much better off using something like Flowplayer. If you just use javascript, all you can do is something like setInterval(), and javascript won’t know anything about the state of the swf — if something prevents the swf from playing within 10 seconds (or whatever you set the interval at), the script will load the next swf anyway — very brittle design. Flowplayer uses playlists where you can define a list of any length, and the next video will only play once the previous is done — regardless of how long it takes. Take a look at this sample. I use JSON to return dynamic lists of variable length. Use whatever server-side language is at your disposal to inspect your file system and return the list of file names.

    If you simply cannot use Flowplayer, note that HTML object syntax varies according to browser/version. I see that you’re loading swfobject.js, yet you’re not using any swfobject functionality. Why? Take a look at the swfojbect javascript API.

    That said, the following script will handle the interval functionality:

    var loadSWFObjects = function() {
        var i = 1;
        var sInt = setInterval(function() {
            if(i >= 50) {
                clearInterval(sInt);
            }else{
                i++;
            }
            document.getElementById("mySWF").innerHTML = "<object type=\"application/x-shockwave-flash\" data=\"SWFObjects/test_" + i + ".swf\" width=\"300\" height=\"120\">";
        }, 10000);
    }
    

    And just do this if you want it to occur on page load:

    window.onload = loadSWFObjects;
    

    If you need a more flexible/modern onload handler, try this or google.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a JavaScript library that supports Ajax as well as help me in
I need to replace our Ajax Modal Popup controls with a JavaScript equivalent. We
I need a Javascript application that, when run, prompts a password to be entered,
I need to debug JavaScript in Internet Explorer 7. Unfortunately, its default debugger doesn't
I have some settings I need in a Javascript file -- servers to connect
I am currently developing a site and have a need for a javascript-based carousel/slider
I need to decrement a Javascript date by 1 day, so that it rolls
I need to run a JavaScript function onLoad(), but only do it if the
I need to output some JavaScript in a WebControl based on some processing and
I need to edit (using javascript) an SVG document embedded in an html page.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.