What's the ultimate way to embed Flash (swf) files to HTML (and XHTML) documents?

戏子无情 提交于 2019-12-03 11:50:12
<head>
    <script src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script> 
    <script>
    var flashVars = {};
    var params = {};
        params.allowScriptAccess = "always";
        params.allowFullScreen = false;
        params.bgcolor = "#1a1a1a";
        params.wmode = "opaque";

        var atts = {};
        atts.id = "my-swf";

    swfobject.embedSWF("my.swf", "my-swfobject", "100%", "100%", "10.1.0", "playerProductInstall.swf", flashVars, params, atts);
    </script>
</head>
<body>
    <div id="my-swfobject">
        <!-- Any <object></object>, <embed></embed>, and everything else here will be rendered for users without JavaScript. If JavaScript is on, SWFObject will destroy div#my-swfobject and replace it with object#my-swf. -->
    </div>
</body>

Let me know if this is what you're looking for. I can elaborate more if needed. You might also consider suggesting that your IE6 slaves install Google Chrome Frame: http://code.google.com/chrome/chromeframe/

Here it is:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
    <head>
        <title></title>
        <script type="text/javascript" src="swfobject.js"> </script>
        <script type="text/javascript">
            swfobject.embedSWF('test.swf', 'myFlash', '320', '240', '9.0.0', '/swfobject/expressInstall.swf', 0, 0, 0);
        </script>
    </head>
    <body>
        <div>
            <object id="myFlash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="320" height="240">
                <param name="movie" value="test.swf">
                <!--[if !IE]>-->
                <object type="application/x-shockwave-flash" data="test.swf" width="320" height="240">
                <!--<![endif]-->
                    <p>Version ???</p>
                <!--[if !IE]>-->
                </object>
                <!--<![endif]-->
            </object>
        </div>
    </body>
</html>

What I've done in the past is statically put my flash content in a div (using both object and embed tags), and then have SWFObject overwrite the contents of that div when it loads. This will be as close to what you want to do as you can get.

Go with dynamic publishing. If the user has javascript turned off, give up. They won't want Flash to run either.

Is there a way to get your clients to install another browser (like Firefox) alongside their legacy one, and use IE6 for the legacy app and FF for yours?

I would take a cue from sites such as YouTube that allow embedding of Flash. Not sure if this will work for non "movie" types.

From YouTube:

<object width="[width]" height="[height]">
<param name="movie" value="[Path to SWF]"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="[Path to SWF]" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="[width]" height="[height]"></embed>
</object>

the only way i see, is doing something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <title>test</title>
</head>
<body>
    <p>
        <object width="160" height="112" data="movie.swf" type="application/x-shockwave-flash">
            <param name="movie" value="movie.swf" />
        </object>
    </p>
</body>
</html>

there is no better option i think. this will work in IE , Mozilla and Webkit browsers and is xhtml valid. but there is no flash installer and no replacement.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!