Flash的SWF不进行初始化,直到可见的 - 我可以强迫他们来初始化? [英] Flash SWF not initializing until visible - can I force them to initialize?

查看:160
本文介绍了Flash的SWF不进行初始化,直到可见的 - 我可以强迫他们来初始化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

予有需要的一系列行之后的多次垂直延伸超过当前可见窗口的呈现约100闪光图(以及其他的DOM的东西)的应用程序 - 换句话说,用户必须滚动向下看看到所有的不同的图形。

I have an application that needs to render about 100 flash graphs (as well as other DOM stuff) in a series of rows that vertically extend many times beyond the current visible window - in other words, the users have to scroll down see see all the different graphs.

此申请也是动态的,当用户在DOM改变的值(在网页上的任何地方),将需要传播该改变所有闪存图形同时

This application is also dynamic and when a user changes a value in the DOM (anywhere on the page) it will need to propagate that change to all the Flash graphs at the same time.

所以我设置的所有ExternalInterface的回调,是注意不能让任何JS开始准备,直到永远那么重要的flashIsReady呼叫并......这真是棒极了,直到我试图更新()现有的SWF的新数据。

So I setup all the externalInterface callbacks and was careful to not let any JS start going until the ever-so-important "flashIsReady" call and...it worked great until I tried to update() the existing swf's with new data.

下面是行为: - 所有在IE /福克斯=好主权财富基金负载(最初)。 - 主权财富基金更新新的内容可以在IE,但不是在福克斯=不好 - 更新与主权财富基金在福克斯--only IF--新内容的作品我向下滚动到页面底部,然后回到顶部 - 在 - 我触发更新()

Here was the behavior: - All the swfs load (initially) in both IE/Fox = good. - Updating swfs with new content works in IE but not in Fox = not good - Updating swfs with new content works in Fox --ONLY IF-- I scrolled down to the bottom of the page, then back to the top -- BEFORE -- I triggered an update().

于是我开始,每次一个swf叫JS说闪是准备好了,我意识到,Firfox只呈现主权财富基金,因为它们变得可见追查出来。而且说实话 - 这很好,实际上,我是pretty的确保IE浏览器这一点。但问题是,不仅火狐无法初始化SWF,火狐甚至不承认存在瑞士法郎(期待onload事件后),如果它尚未可见。

So then I started tracing out each time a swf called the JS to say "flash is ready" and I realized, Firfox only renders swfs as they become visible. And To be honest - that's fine and actually, I am pretty sure that IE does this too. But the problem is that not only does Firefox not initialize the swf, Firefox doesn't even acknowledge the swf exists (expect for after onload) if it has not yet been visible.

和证明的是,你得到JS错误,他说:

And the proof is that you get JS errors saying:

[FlashDOMID] .FlashMethod不是一个函数。

"[FlashDOMID].FlashMethod is not a function".

不过,向下滚动了一下,等到它的可见光和突然的跟踪开始照亮了

However, scroll down a little, wait until its visible and suddenly the trace starts lighting up

Flash就绪,Flash就绪,Flash就绪,一旦他们都准备好了,一切工作正常。

"Flash Ready", "Flash Ready", "Flash Ready" and once they are all ready, everything works fine.

有人告诉我,FF没有初始化的SWF的,直到看到 - 我可以强制它?我可以张贴code,如果你需要...但它pretty的重(很难剥离出相关的其余部分),我想,以避免它(为你们)如果可能的话。

Someone told me that FF does not init swf's until visible - can I force it? I can post code if you need...but its pretty heavy (hard to strip out the relevant from the rest) and I would like to avoid it (for your sakes) if possible.

现在的问题很简单 - 你有没有过这种情况,如果是这样,你有没有找到解决的办法?有没有人现在怎么强制还未可见SWF初始化?谢谢你们。

The question is simple - have you had this happen and if so, did you find a solution? Does anyone now how to force a not-yet-visible swf to initialize? Thanks guys.

推荐答案

所以...

很多论坛搜索后 - 我同意,没有优雅的方式来做到这一点,哈哈!该解决方案我最终去为基本上使JS对象的每个SWF在$(文件)。就绪()

After a lot of forum searching - I agree, there is no graceful way to do this haha! The solution I ended up going for was basically to make JS objects for each swf on $(document).ready()

基本上,对JS对象将具有各种值,其中数据和isReady。当SWF显形,并会调用JS说我已经准备好我只想抓到那个电话,然后找JS对象,它指的是(我设法通过将DOM ID为每个SWF为一个做到这一点的FLASHVARS;是的,它让我觉得脏)。从那里,它基本上只是一个游戏,以确保之前,我试图操纵它的每一个JS们isReady。

Basically, the JS object would have various values, among them "data" and "isReady". When a swf became visible and would call the JS to say "im ready" I would simply catch that call, then find the JS object it was referring to (I managed to do this by passing the DOM id for each swf as one of its flashVars; yes it made me feel dirty). From there it was basically just a game to make sure that the each JS had "isReady" before I tried manipulating it.

优雅在这整个烂摊子的唯一的一点是,通过JS对象,我仍然可以通过简单地更新在各自的JS对象的数据属性应用于新的数据,隐藏主权财富基金。然后,当SWF终于成为可见的,我只想更新​​所有数据,有(即,当前数据)和它的工作pretty的很好,但,是的,我仍然认为,这整个情况是不幸的。

The only bit of elegance in this whole mess was that by using JS objects, I could still apply new data to "hidden" swfs by simply updating the "data" property in their respective JS objects. Then, when a swf finally became visible, I would just update whatever data it had (ie, current data) and it worked pretty well but yeah, I still agree that this whole situation is unfortunate.

所以... *回答。

So... *answered.

这篇关于Flash的SWF不进行初始化,直到可见的 - 我可以强迫他们来初始化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆