gpt4 book ai didi

Flash (wmode=window) 在调用 facebook 对话框后消失

转载 作者:行者123 更新时间:2023-12-01 12:59:39 27 4
gpt4 key购买 nike

我们正在为 facebook 编写应用程序。这是一个用 flash 编写并嵌入 wmode 窗口 的游戏。我们在 Firefox 6 上遇到问题,但仅限于 Windows XP。当用户调用某些 facebook 对话框(例如:支付对话框或购买更多积分对话框)时,flash 会消失。当用户单击通知(顶部 facebook 菜单中的地球图标)并按住它一段时间(但这并不那么重要)时,也会发生同样的情况。

flash 消失后它仍然在 DOM 中为 <object> .创建墙报对话框时不会发生这种情况。

如何解决?

我们不能改变wmode,所以这种方式是不可能的。

最佳答案

FB.init 文档:https://developers.facebook.com/docs/reference/javascript/FB.init/#flash如果您的应用程序无法使用 wmode="opaque",则为您提供一些比显示白色背景更好的选择。

Adobe Flash applications on facebook.com

For Canvas applications using Adobe Flash, wmode="opaque" is preferred whenever possible. We have found that, on modern browsers with hardware compositing, there is generally no performance degradation to using wmode="opaque". Otherwise, Facebook will, by default, hide your Flash objects when popup events occur, and redisplay them when the popup is dismissed.

If you need to use wmode="window", and would like to control this behavior (such as also showing text or an image when this happens) you can provide a function into the hideFlashCallback parameter to FB.init. hideFlashCallback takes a state field as part of the passed in parameters saying whether the window is being opened or closed. This is the default implementation that you'll be overriding if you provide one, but may also give you an idea of what your override would look like:

function(params) {
var candidates = window.document.getElementsByTagName('object');
for (var i = 0; i < candidates.length; i++) {
var elem = candidates[i];
if (elem.type != "application/x-shockwave-flash") {
continue;
}

var good = false;
for (var j = 0; j < elem.childNodes.length; j++) {
if (elem.childNodes[j].nodeName == "PARAM" && elem.childNodes[j].name == "wmode") {
if (elem.childNodes[j].value != "window" && elem.childNodes[j].value != "default") {
good = true;
}
}
}
if (!good) {
if (params.state == 'opened') {
elem.style.old_visibility = elem.style.visibility;
elem.style.visibility = 'hidden';
} else if (params.state == 'closed') {
elem.style.visibility = elem.style.old_visibility;
elem.style.old_visibility = '';
}
}
}
}

Note: Some UI methods like stream.publish and stream.share can be used without registering an app or calling this method. If you are using an app id, all methods must be called after this method.

关于Flash (wmode=window) 在调用 facebook 对话框后消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7332546/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com