2

我使用 google swiffy 将我的 swf 文件转换为 html5。但是现在 google 已将运行时升级到 v 5.2 并且不能使用透明背景。在我从 swf 文件和谷歌代码中使用 google swiffy html5 的 runtime v 4.9 之前,我从我的 javascript 文件中删除它以使用透明背景:

"backgroundColor":-1,  

但是现在运行时已升级到 v5.2,我无法从 swiffy 文件中删除背景颜色

https://www.gstatic.com/swiffy/v5.2/runtime.js

4

7 回答 7

1

此解决方案与 flash cs5 -> swiffy v5.3 完美配合!

#swiffycontainer rect {
    background: none !important;
    display:none !important;
}
于 2013-10-15T13:03:40.240 回答
0
<style type="text/css" media="screen">
#div *:first-child {
      background-color: transparent !important;
}
</style>
于 2013-06-22T13:39:43.700 回答
0

谷歌有答案:

https://www.google.com/doubleclick/studio/swiffy/faq.html

我怎样才能使背景透明?

如果您需要通过 wmode="transparent" 属性使背景透明,您可以在 Swiffy 输出中插入以下代码片段,就在调用 stage.start() 之前:

stage.setBackground(null);

您还可以将 null 替换为任何有效的 CSS 颜色规范字符串,以覆盖转换中定义的背景颜色。

于 2013-10-16T08:37:40.840 回答
0

Roger 的解决方案非常适合我:我在 Wordpress 环境中使用 Swiffy,所以这就是我所做的:

1) 将 Swiffy 生成的代码添加到 header.php 文件中(实际上是 header-home.php,所以我可以只为一页调用它)。

2)在 Swiffy 之前,添加 Roger 的代码:

<style type="text/css">
#swiffycontainer div {
    background-color: transparent !important;
}
</style>

3) 将 Swiffy 生成的代码(在标签关闭之前)放入 footer.php 文件(在我的例子中也是 footer-home.php)。

4) 将 Swiffy 容器(默认为 'id="swiffycontainer"')Div 放在 WordPress 页面上。

哒哒!我会简单地投票给罗杰,但我没有代表这样做。另外,我认为我的 WordPress 情况可能对其他人有所帮助。

于 2013-06-27T16:54:22.017 回答
0

在网上搜索和搜索后,尝试了一切,也在这篇文章中描述,终于找到了解决方案!

将flash CS6中的.swf和.swf导出为html5(canvas)时,在html编辑器中打开导出的.html文件,将background-color属性改为#transparent”

例子:

<body onload="init();" style="background-color:#transparent">
    <canvas id="canvas" width="550" height="300" style="background-color:#transparent"></canvas>
</body>

好吧,它对我来说很好用!

于 2014-05-23T15:35:35.670 回答
0

为了扩展这个答案:我正在运行 Swiffy 5.2.0,这在一开始就不起作用,因为内部生成的代码在我的情况下是不同的,它看起来像这样:

<div id="my-container">
    <!-- Begins Swiffy generated code -->
    <div style="position: relative; height: 100%; overflow: hidden; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); background-color: rgb(102, 121, 14); cursor: default; background-position: initial initial; background-repeat: initial initial;">
        <svg color-interpolation-filters="sRGB" style="fill-rule: evenodd; pointer-events: none; -webkit-user-select: none; width: 100%; height: 100%;">
            <!-- svg contents here -->
        </svg>
    <!-- Ends Swiffy generated code -->
    </div>
</div>

请注意,my-container 是我在阶段构造函数中分配的容器,不是由 Swiffy 生成的。

只需检查生成的代码并根据需要调整 css 选择器,最初的想法仍然保持不变:

<style type="text/css">
    #my-container div {
        background-color: transparent !important;
    }
</style>
于 2013-06-27T02:41:22.833 回答
0

您可以在启动阶段后调用“setBackground”方法为空。像这样,

stage.start();
stage.setBackground(null); 
于 2015-12-21T20:09:20.040 回答