设置swfobject的路径

发布于 2024-10-15 14:08:20 字数 1261 浏览 3 评论 0原文

我在设置 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冬天旳寂寞 2024-10-22 14:08:20

使用绝对路径:

数据=“/project/resources/test.swf”

Use absolute paths:

data="/project/resources/test.swf"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文