Percentage loading bar for a SWF file through JavaScript
I have jsp that is suppose to load the .swf file which is large in size which takes of about 7 sec to load completely, could I hide the loading and put the J开发者_如何学编程avaScript percentage loading bar for Swf file.
As far as I know, you can't build a proper progress bar for a single file in JavaScript. Progress bars for web sites usually monitor load completion for multiple images to fake having access to the actual percentage of a page being loaded (if 1 out of 10 images is loaded, that's 10 percent, right?).
Alternatively, you could show an animated GIF, something like a spinning wheel or something else that moves and is not directly related to the size of the file being loaded. You would then add a listener to the page's onLoad event, and hide the GIF when it's fired.
...or you can still have a nice progress bar, if you don't do it in JavaScript: Try reorganizing your Flash file instead! Here is a tutorial on preloading a single SWF file.
精彩评论