我使用google swiffy将我的swf文件转换为html5。 但现在谷歌将运行时升级到v 5.2并且无法使用透明背景。 在我使用swf文件和google代码中的google swiffy html5的运行时v 4.9之前,我从我的javascript文件中删除了这个以使用透明背景:
"backgroundColor":-1,
但现在运行时升级到v5.2,我不能从swiffy文件中删除背景颜色
答案 0 :(得分:1)
此解决方案与flash cs5完美配合 - > swiffy v5.3!
#swiffycontainer rect {
background: none !important;
display:none !important;
}
答案 1 :(得分:0)
<style type="text/css" media="screen">
#div *:first-child {
background-color: transparent !important;
}
</style>
答案 2 :(得分: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>
答案 3 :(得分: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)在WordPress页面上放置Swiffy容器(默认情况下为'id =“swiffycontainer”)。
TAH-大新!我本可以简单地投票给Roger,但我没有代表这样做。另外我认为我的WordPress情况可能有助于其他人。
答案 4 :(得分:0)
GOOGLE有答案:
https://www.google.com/doubleclick/studio/swiffy/faq.html
如何让背景透明?
如果你需要使背景透明,就像wmode =“transparent”属性一样,你可以在调用stage.start()之前在Swiffy输出中插入以下代码片段:
stage.setBackground(空);
您还可以使用任何有效的CSS颜色规范字符串替换null,以覆盖转换中定义的背景颜色。
答案 5 :(得分:0)
在网上搜索和搜索后,尝试了一切,也在这篇文章中描述,最后我找到了解决方案!!
当您将flash CS6中的.swf导出到html5(画布)时,打开html编辑器中导出的.html文件,并将background-color属性更改为#transparent&#34;
示例:
<body onload="init();" style="background-color:#transparent">
<canvas id="canvas" width="550" height="300" style="background-color:#transparent"></canvas>
</body>
嗯,它适用于我!
答案 6 :(得分:0)
启动阶段后,您可以调用“setBackground”方法为null。像这样,
stage.start();
stage.setBackground(null);