通过Flash显示网页
我有一个带有某些选项卡的网页,并使用 jquery 添加 flash
swf 默认显示,当您单击选项卡 2、3 或 4 时,该页面的内容将显示在 flash 上。 (意味着Flash继续运行)
这就是我尝试的
<div id="game">
You must have flash installed to view this game
</div>
in javascript file:
swfobject.embedSWF("flash.swf", "game", 500, 500, "7");
$("#tab1").click(function(){
$("#content-2").hide();
$("#content-3").hide();
$("#content-4").hide();
$("#content-1").show();
});
$("#tab2").click(function(){
$("#content-1").hide();
$("#content-3").hide();
$("#content-4").hide();
$("#content-2").show();
});
隐藏的问题是Flash swf重新加载。我需要它保持原来的样子。我该怎么做?我想要的一个完美的例子就是 Facebook 上的《奇迹之城》游戏中的选项卡。
编辑:
我尝试执行 swfobject.addParam("wmode", "transparent") 但这似乎会导致错误,说 addParam 不存在。
已解决:
好吧,我玩了很多,发现了问题。
我不能隐藏包含 swf 的 div 或将其显示设置为无,因为这将重新加载。
关键是wmode=透明。现在我不知道 addParam 是否已被弃用或者是什么,但这就是有效的。
var flashvars = {};
var params = {};
params.wmode = "transparent";
var attributes = {};
swfobject.embedSWF("flash.swf", "game", 580, 680, "8","expressInstall.swf", flashvars, params, attributes);
在此之后,我所做的就是隐藏所有 div(除了包含 swf 的 div),无论我执行 .show 到哪个 div 都会显示。无需使用 z-index,因为如果我对 swf 所在的 div 执行 .show(即使它没有隐藏),它会将其放在顶部!完美的 !
I have a web page with certain tabs and adding flash with jquery
The swf is shown on default, and when you click tab 2, 3 or 4, the content of that page is shown over the flash. (meaning the flash continue to run)
This is what I attempted
<div id="game">
You must have flash installed to view this game
</div>
in javascript file:
swfobject.embedSWF("flash.swf", "game", 500, 500, "7");
$("#tab1").click(function(){
$("#content-2").hide();
$("#content-3").hide();
$("#content-4").hide();
$("#content-1").show();
});
$("#tab2").click(function(){
$("#content-1").hide();
$("#content-3").hide();
$("#content-4").hide();
$("#content-2").show();
});
The problem with hide is that the flash swf reloads. I need it to remain however it was. How would I do this? A perfect example of what I want is like the tabs in the game City of Wonders on facebook.
EDIT:
I tried doing swfobject.addParam("wmode", "transparent") but this seems to cause error saying addParam doesn't exist.
SOLVED:
Ok so I played around a lot and found the problem.
I must not hide the div containing the swf or set it's display to none because this will reload.
The key is wmode=transparent. Now I don't know if addParam has been deprecated or what but this is what worked.
var flashvars = {};
var params = {};
params.wmode = "transparent";
var attributes = {};
swfobject.embedSWF("flash.swf", "game", 580, 680, "8","expressInstall.swf", flashvars, params, attributes);
after this all I do is hide all the divs(except the one containing the swf), whichever div I do .show to will be shown. No need to use z-index because if I do .show to the div the swf is in(even if it is not hidden) it will put it on top ! perfect !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
wmode=transparent
作为电影参数可能会解决该问题,尝试一下并告诉我!
wmode=transparent
as parameter on the movie probably will solve the issue, try it out and let me know!
尝试更改 css 'display' 值,或更改 z-index 以“隐藏”页面 div 下的 div,而不是使其消失。
Try to change css 'display' value, or change z-index to "hide" your div under the page's div instead of disappearing it.