I have a simple HTML page that contains开发者_StackOverflow two tabs that show/hide content in the same space.
The first tab contains an SWF file that is embedded using SWFObject.js.
When switching between tabs, I would like the SWF file to pause or stop. This works fine on all browsers except IE7+, which is a known problem.
What could be possible resolutions?
A simple solution would be to remove the SWF file from the DOM and re-insert it every time the first tab is selected and loaded.
A better solution would be to pause/stop the SWF file using Javascript or jQuery. How can I go about doing this?
The SWF file is generated using Adobe Captivate 5. Do I need to expose a pause/stop method using ExternalInterface API that Javascript/jQuery can call? Or, is there a standard method for pause/stop that is exposed for all SWF files that I can simply call?
Easy:
document.getElementById("movieName").StopPlay();
then
document.getElementById("movieName").Play();
Note: Never used SWFObject.js nor do I know anything about it but this should work for all normal embedding techniques, see this post for specific on how I normally embed swf files.
Try the CaptivateController utility; it was designed specifically for controlling Captivate SWFs via JavaScript.
精彩评论