在不访问 fla 的情况下向 swf 添加简介或:顶级 swf 和加载的 swf 之间的差异
我必须(快速!)向我继承的网站上的现有 Flash 标头添加介绍。我无权访问源 .fla,因此我通过将介绍放入包装器 swf 中并加载当前标头并将其添加到 Event.INIT
上的显示列表来解决该问题。到目前为止,一切都很好。 (顺便说一句,swf 是为 flash 播放器 9 构建的并使用 AS3。)
我遇到的问题是,虽然介绍播放良好并加载/显示报头 swf 的开头(这是一个加载动画),但报头本身永远不会实际上在玩。从本质上讲,我的问题是:当基于 ActionScript 3 的 swf 是另一个 swf 的子级而不是嵌入的 swf 的顶层时,什么会导致其行为不同?
潜在的重要细节:嵌入是用 swfobject 处理的,并且没有传入 flashvar。有两个参数,分别是 base: "/flash/"
和 wmode: "opaque"< /代码>。所有 swf 和 flash 数据都位于
/flash/
中。 Flash 元素(减去我构建的介绍)是使用 Inky flash 框架 构建的,其中我不熟悉。
更新:我重新考虑了解决问题的方法,并通过使用ExternalInterface使其正常工作;我让介绍 swf 在播放完毕后调用 js 函数,该函数会交换介绍 swf 并将其替换为当前的刊头(该方法概述 此处)。不过,我仍然想知道为什么我会目睹我之前看到的行为,因此欢迎任何想法和建议。
I've got to (quickly!) add an intro to an existing flash masthead on a site that I've inherited. I don't have access to the source .fla's, so I approached the problem by putting the intro in a wrapper swf and loading the current masthead and adding it to the display list on Event.INIT
. So far, so good. (Incidentally, the swfs are built for flash player 9 and use AS3.)
The problem I'm having is that although the intro plays fine and loads / displays the beginning of the masthead swf, which is a loading animation, the masthead itself never actually plays. Essentially, my question is: what would cause an actionscript 3-based swf to behave differently when it's the child of another swf as opposed to at the top level of the embedded swf?
Potentially important details: Embedding is being handled with swfobject, and no flashvars are being passed in. There are two params, which are base: "/flash/"
and wmode: "opaque"
. All the swfs and flash data live in /flash/
. The flash elements (minus the intro I built) were constructed using the Inky flash framework, with which I'm not familiar.
UPDATE: I've reconsidered my approach to the problem and gotten it working by using ExternalInterface; I'm having the intro swf call a js function when it finishes playing, which swaps out the intro swf and replaces it with the current masthead (the approach is outlined here). I'd still like to know why I was witnessing the behavior I was seeing earlier, though, so any ideas and suggestions would be welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 Flash 文件可能存在一些潜在问题。
如果您的 swf 是在 AS2 中编译的,则它可能会引用 _root,当它加载到另一个 swf 中时,它会变得混乱。在 AS2 中,您可以使用 _lockroot 来绕过它。在 AS3 中,这不再是问题,因为 _lockroot 是继承的。
如果您的电影是基于时间线的电影,您可以尝试调用 play() 函数。
如果您的简介加载外部资源,您将需要确保所有外部资源的路径设置正确。尝试将容器的 swf 文件和简介放在同一目录中。或者使用 Safari 活动窗口进行故障排除,查看是否有任何“404 未找到”。
另一件事是Flash版本不一致。如果您将 Flash 版本 9 与 Flash 版本 10 一起加载,则可能会遇到问题。
希望这些指示有所帮助。
There could be a couple of potential problems with your flash files.
If your swf was compiled in AS2, it could be referencing _root which would be messed up when it is loaded into another swf. In AS2, you can get around it by using _lockroot. In AS3, this is not longer a problem because _lockroot is inheritted.
If your movie was a timeline based movie, you can try to invoke the play() function.
If your intro loads external assets, you will want to make sure your paths are set correctly for all your external assets. Try to put the swf file of your container and the intro in to the same directory. Or troubleshoot by using the Safari Activity window to see if you have any "404 not found".
Another thing is inconsistent flash version. You could run into problem if you load a Flash version 9 with a Flash version 10.
Hope these pointers help.