0

I have a webpage with several swf movies that is created in dreamweaver and outputs several object tags like such:

<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="160" height="600">
    <param name="movie" value="Banners Template/Example_160x600.swf" />
    <param name="quality" value="high" />
    <param name="wmode" value="opaque" />
    <param name="swfversion" value="9.0.45.0" />
    <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
    <param name="expressinstall" value="Scripts/expressInstall.swf" />
    <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. --> 
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="Banners Template/Example_160x600.swf" width="160" height="600">
      <!--<![endif]-->
      <param name="quality" value="high" />
      <param name="wmode" value="opaque" />
      <param name="swfversion" value="9.0.45.0" />
      <param name="expressinstall" value="Scripts/expressInstall.swf" />
      <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
      <div>
        <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
        <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
      </div>
      <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
  </object>
<script type="text/javascript">
swfobject.registerObject("FlashID");
</script>

I would like to do the following:

  1. The Swf animation runs once through on page load(This is currently happening)
  2. Once user clicks a 'Replay Movie' button, the swf it is associated with will replay until the movie finishes.

I have been trying to find some code that can utilize javascript or jQuery to either reload the contents of the object tag or replay the swf with no success. How can I replay a swf movie on jquery button click?

4

1 回答 1

0

演示:http: //jsfiddle.net/tive/Ff7Mq/

演示2:http : //jsfiddle.net/tive/J6WQm/

捕获事件并更改文件的源。或者使用您的 swf 对象再次呈现 div。

var initVideos = function () {
    var divs = $("ul li a");

    // bind your click event to the divs
    divs.click(function (e) {
        e.preventDefault(); // use this when you're triggering anchor tags
        flashembed("videoArea", $(this).prop("href"));
        divs.removeClass("active");
        $(this).addClass("active");
    });
};
于 2013-05-01T19:12:00.003 回答