【发布时间】:2016-08-30 04:44:00
【问题描述】:
我在玩 Flash 游戏时遇到了问题。我必须在网页上的 iframe 中实现它,它必须在 Firefox 中运行。游戏本身是一个自己的网页,它用库swfobject加载flash对象。 如果我直接在 Firefox 中打开游戏,它会加载并可以玩。如果我打开开发者工具,那么游戏的视频就会被隐藏,我看到的只是一个白页。音乐仍在播放。
奇怪的行为是,当我点击 body 标签时,游戏是不可见的。如果我单击标题标签,则游戏可见。 当我在 iframe 中打开游戏时,它是不可见的,就像打开开发者工具时一样。
我还有其他一些加载完美的游戏。它们之间的区别在于 wmode。不工作的游戏使用 wmode “gpu”。其他的“透明”。但是游戏本身需要wmode gpu或者direct,因为它使用了Stage3D什么的。
iframe 从 angular-material 库加载到 md 对话框中。我也使用 AngularJS。
游戏在 Chrome 中运行良好!
有人知道如何解决这个问题吗?
这是在游戏的 index.html 中。
<script type="text/javascript">
// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "11.1.0";
// To use express install, set to playerProductInstall.swf, otherwise the empty string.
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
var params = {};
params.quality = "high";
params.bgcolor = "#ffffff";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
params.wmode = "gpu";
//params.scale = "noborder";
var attributes = {};
attributes.id = "Flash";
attributes.name = "Flash";
attributes.align = "middle";
swfobject.embedSWF(
"flash.swf", "flashContent",
"1180", "660",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
//swfobject.createCSS("#flashContent", "display:block;text-align:left;");
</script>
index.html 正在加载:
<iframe id="iframe" scrolling="no"></iframe>
$('#iframe').attr('src',vm.urlD);
其中 vm.urlD 是游戏 index.html 的解析 URL。
css 样式 iframe:
iframe{
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
height: 100%;
width: 100%;
overflow: hidden;
border: none;}
【问题讨论】:
-
您是否有机会使用 Starling 作为游戏引擎?
-
我不知道...这游戏根本不是我自己开发的。
-
根据经验,我知道使用 Stage3D 调整闪存容器的大小会导致您描述的症状。但这无法从 Flash 客户端外部修复。
-
但我不会调整 iframe 或其他东西的大小。开发游戏的人不知道错误可能是什么。有没有可能,那种有角度或有角度的材料类型会调整闪光对象的大小?
-
我真的相信错误在于 Flash 客户端。如果 Flash 中的 3D 舞台较小,则出现此问题的视口。您可以要求游戏开发人员使用各种 Context3d 配置文件(请参阅adobe.com/devnet/flashplayer/articles/stage3d-profiles.html)
标签: javascript flash firefox apache-flex iframe