Having trouble embed a swf in swfobject
I'm following the steps here:
http://code.google.com/p/swfobject/wiki/documentation
I'm embedding it this way:
<!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" lang="en" xml:lang="en">
<head>
<title>SWFObject dynamic embed - step 3</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
html, body, #myContent { height:100%; }
body { margin:0; padding:0; overflow:hidden; }
</style>
<script type="text/javascript" src="js/swfobject/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("flash/main.swf?sessionId=psjqbunbdoapfqt1cskggvsdi2", "myContent", "100%", "100%", "9.0.0", "js/swfobject/expressInstall.swf");
</script>
</head>
<body>
<table style="width:100%;height:100%;">
<tr>
<td style="width:350px">
<div id="myContent">
<p>Alternative content</p>
</div>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="main" width="100%" height="100%"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="flash/main.swf?sessionId=psjqbunbdoapfqt1cskggvsdi2" />
<param name="quality" 开发者_运维知识库value="high" />
<param name="bgcolor" value="#eeeeee" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="flash/main.swf?sessionId=psjqbunbdoapfqt1cskggvsdi2" quality="high" bgcolor="#eeeeee"
width="100%" height="100%" name="main" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</noscript>
</td>
</tr>
</table>
</body>
</html>
It turns out that the flash content is not visibie at all,why?
Get rid of all the additional stuff, like the <table>
, <noscript>
, CSS etc. Just leave swfobject and the <div>
(no style attributes, either!) in an otherwise empty HTML construct.
If it doesn't show at all: There is something wrong with your swf, or swfobject doesn't load correctly.
If it does show: Start adding stuff. First re-enter the style attributes. Reload. Go on until your content disappears => you know where your problem is!
Also: I would advise not to put an additional <noscript>
in there - that's what "alternative content" is meant for. You should really put something alternative in there, like a picture or text, and link to the flash plugin download page.
精彩评论