如何在HTML页面上嵌入SWF?

时间:2010-12-01 09:26:28

标签: html cross-browser flash

我现在正试图在HTML文件中正确显示SWF项目,并在所有浏览器中实现良好的集成。

SWF在那里:http://bitbucket.org/natim/cip-qcu-editor/raw/4746bbb86427/qcu/swf/quiz.swf 我尝试使用这种方法:http://latrine.dgx.cz/how-to-correctly-insert-a-flash-into-xhtml而且这个方法:http://www.bobbyvandersluis.com/swfobject/generator/index.html没有成功。

实际上它可以工作但不能用于启动动画的Firefox 3.6。

你知道我怎么能让它奏效吗?

由于

1 个答案:

答案 0 :(得分:1)

我终于像这样使用了SWFObject:

<html>
  <head>
    <title>Qcu - CIP UTBM &copy; 2010</title>
    <meta name="author" content="Rémy HUBSCHER"/>
    <style type="text/css">
      * { margin: 0; padding: 0; }
      html, body { width: 100%; height: 100%; background-color: #3f3fFF; }
      div, object { width: 100%; height: 100% }
    </style>
    <script type="text/javascript" src="js/swfobject.js"></script>
  </head>
  <body>
    <div id="quiz_content">
      <object type="application/x-shockwave-flash" name="quiz" id="quiz" data="swf/quiz.swf">
    <param value="swf/quiz.swf" name="movie"/>
    <param value="true" name="play"/>
    <param value="true" name="loop"/>
    <param value="true" name="allowfullscreen"/>
    <param value="always" name="allowscriptaccess"/>
    <param value="high" name="quality"/>
    <param name="wmode" value="window" />
    <param name="scale" value="showall" />
    <param name="flashvars" value="xml_file=XML/quiz.xml"/>
      </object>
    </div>

    <script type="text/javascript">
      var flashvars = {
        xml_file: "XML/quiz.xml"
      };

      var params = {
        wmode: "window",
        play: "true",
        loop: "true",
        allowfullscreen: "true",
        scale: "showall",
        allowscriptaccess: "always",
      };

      var attributes = {
        id: "quiz"
      };
      swfobject.embedSWF("swf/quiz.swf", "quiz_content", "100%", "100%", "9.0.0", false, flashvars, params, attributes);
</script>


  </body>
</html>