Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preload and Display/Hide Three Flash Files

Status
Not open for further replies.

mkallover

Programmer
Feb 6, 2008
88
US
Hi all,

I am working on a dashboard for my company intranet and I am trying to speed up its presentation. The dashboard is based on SWF files created using Crystal Xcelsius that are embedded into separate HTML pages. I have three different dashboards and navigating between them can be time consuming because it takes about 20-30 seconds to load the dashboard when the user navigates to the page.

What I would like to do is to have all three loaded on one page and then show/hide them based on clicking a link. I used the FAQ at: but when the div is shown for the first time the Flash file still has to load. Once each link has been clicked, the Flash files display immediately.

What I would like to do is to load the two invisible Flash files at the same time as the visible Flash file is loading. That way the user only has to wait once.

Any thoughts?
 
I'm certainly not an expert so my appoogies if this doesn't work out for you.

You could try leaving the divs visible in the HTML code and have javascript hide them once the files have loaded to the client. the body's onload event should work for this.

It might look something like this:
Code:
<head>
  <script language=javascript>
    function toggleDivs(show) {
      divs = ['','flash1','flash2','flash3'];
      for (var i = 1; i < 4; i++) {
        div = document.getElementById(divs[i]);
        if (i == show) {
          div.style.visibility = 'visible';
        } else {
          div.style.visibility = 'hidden';
        }
      }
    }
  </script>
</head>
<body onload='toggleDivs(1)'>
  <div id=flash1>
    [...I have no idea how a flash file is embedded...]
  </div>
  <input type=button onclick='toggleDivs(1)' value='Show Flash File 1'>
  <div id=flash2>
    The Second Flash File
  </div>
  <input type=button onclick='toggleDivs(2)' value='Show Flash File 2'>
  <div id=flash3>
    The Third Flash File
  </div>
  <input type=button onclick='toggleDivs(3)' value='Show Flash File 3'>
</body>

As I said I'm no expert so this is likely more brute force than elegance.

I hope that helps

David I. Taylor
Network Administrator
ODIM Brooke Ocean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top