设置swfobject的路径
我在设置 swfobject 的路径时遇到麻烦。在我的项目目录结构中,我将 swfobject.js 和 loadmovie.js 文件放在“Project/src/main/webapp/resources”目录中。在同一目录中,我放置了 test.swf 文件。 loadmovie.js 的内容是:
var swfVersionStr = "10.0.0";
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
var params = {};
params.wmode = "transparent";
params.quality = "high";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "test";
attributes.name = "test";
attributes.align = "left";
swfobject.embedSWF("test.swf", "movieDiv", "202", "380", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes);
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
但是 test.swf 没有加载网页。如果我在渲染后查看网页的源代码,swfobject 将转换为:
<object type="application/x-shockwave-flash" id="test" name="test" align="left" data="test.swf" width="202" height="380">
<param name="wmode" value="transparent">
<param name="quality" value="high">
<param name="allowscriptaccess" value="sameDomain">
<param name="allowfullscreen" value="true">
</object>
如果我将 data="test.swf" 替换为 data="http://localhost/project/resources/test.swf" 则 swf 可见。请帮忙。我该如何设置路径?谢谢
I am facing trouble to set the path of swfobject. In my project directory structure I put the swfobject.js and loadmovie.js files in the "Project/src/main/webapp/resources" directory. In same directory I placed the test.swf file. The content of loadmovie.js is:
var swfVersionStr = "10.0.0";
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
var params = {};
params.wmode = "transparent";
params.quality = "high";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "test";
attributes.name = "test";
attributes.align = "left";
swfobject.embedSWF("test.swf", "movieDiv", "202", "380", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes);
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
But the test.swf is not loading the web page. If I view the source of the webpage after rendering the swfobject is transforming as :
<object type="application/x-shockwave-flash" id="test" name="test" align="left" data="test.swf" width="202" height="380">
<param name="wmode" value="transparent">
<param name="quality" value="high">
<param name="allowscriptaccess" value="sameDomain">
<param name="allowfullscreen" value="true">
</object>
And if I replace the data="test.swf" by data="http://localhost/project/resources/test.swf" then swf is visible. Please help. How can I set the path? Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用绝对路径:
Use absolute paths: