Internet Explorer中的Flash,Javascript时间冲突 [英] Flash, Javascript Time Conflict in Internet Explorer

查看:71
本文介绍了Internet Explorer中的Flash,Javascript时间冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行两个Flash动画的网页。我还有一个

javascript脚本运行,可以旋转3个图像并淡入它们并且

out。要在javascript中进行淡入淡出和旋转,我使用的是

setInterval函数,如下所示:


setInterval(function(){imageFade()},10 );

这在Firefox中运行良好,但在IE 7中,flash动画减慢了很多,而javascript的衰落/旋转减慢了一些。


在IE 7中,闪存和

javascript之间似乎存在时序冲突。关于如何在IE 7中修复此问题的任何建议?

I have a webpage that has two flash animations running. I also have a
javascript script running that rotates 3 images and fades them in and
out. To do the fading and rotating in javascript I am using the
setInterval function, like this:

setInterval(function () {imageFade()},10);
This works fine in Firefox, but in IE 7, the flash animations slow
down a lot, and the javascript fading/rotation slows down some.

There seems to be a timing conflict in IE 7 between flash and
javascript. Any suggestions on how to fix this in IE 7?

推荐答案

9月28日下午1:12,泥... 。@ gmail.com" < mud ... @ gmail.comwrote:
On Sep 28, 1:12 pm, "mud...@gmail.com" <mud...@gmail.comwrote:

我有一个运行两个flash动画的网页。我还有一个

javascript脚本运行,可以旋转3个图像并淡入它们并且

out。要在javascript中进行淡入淡出和旋转,我使用的是

setInterval函数,如下所示:


setInterval(function(){imageFade()},10 );
I have a webpage that has two flash animations running. I also have a
javascript script running that rotates 3 images and fades them in and
out. To do the fading and rotating in javascript I am using the
setInterval function, like this:

setInterval(function () {imageFade()},10);



这个imageFade函数看起来是什么样的,为什么每秒调用它一百美元?b / b

What does this imageFade function look like and why call it a hundred
times per second?


mu****@gmail.com 写道:

我有一个运行两个flash动画的网页。我还有一个

javascript脚本运行,可以旋转3个图像并淡入它们并且

out。要在javascript中进行淡入淡出和旋转,我使用的是

setInterval函数,如下所示:


setInterval(function(){imageFade()},10 );


这在Firefox中运行良好,但在IE 7中,flash动画减慢了很多次,而javascript的衰落/旋转减慢了一些。


在IE 7中,闪存和

javascript之间似乎存在时序冲突。有关如何在IE 7中解决此问题的任何建议?
I have a webpage that has two flash animations running. I also have a
javascript script running that rotates 3 images and fades them in and
out. To do the fading and rotating in javascript I am using the
setInterval function, like this:

setInterval(function () {imageFade()},10);

This works fine in Firefox, but in IE 7, the flash animations slow
down a lot, and the javascript fading/rotation slows down some.

There seems to be a timing conflict in IE 7 between flash and
javascript. Any suggestions on how to fix this in IE 7?



可能发生的一件事是每10毫秒调用你的imageFade

函数并没有留下足够的时间来处理所有事情/>
来运行。您可以尝试进行一些测量。在imageFade的开头和最后记下时间

。你可能会发现它的价格接近10毫秒。出于这个原因,我从不使用带有

短时间的setInterval。对我来说,如果时间不到一秒钟,那么我通常会优先使用setTimeout,并在你的

函数结束时设置一个setTimeout用于下次调用。通过使用setTimeout,您可以保证一定数量的空闲时间。直到下一个电话。没有完美的

解决方案,浏览器环境是一个受控制的沙箱,只有当该环境的开销是允许的时候才能以最快的速度运行


管理也被计算在内。

One thing that might be happening is that calling your imageFade
function every 10 milliseconds isn''t leaving enough time for everything
to run. You could try making some measurements. Make a note of the time
at the start of your imageFade and also at the end. You might find it''s
close to 10ms. It''s for this reason that I never use setInterval with a
short time. For me, if the time is less than a second, then I usually
prefer to use setTimeout, and put a setTimeout at the end of your
function for the next call. By using setTimeout, you''re guaranteeing a
certain amount of "free time" until the next call. There''s no perfect
solution, the browser environment is a controlled sandbox and things run
only as fast as allowed when the overhead of that environment being
managed is also accounted for.


mu **** @ gmail .com 写道:

我有一个运行两个flash动画的网页。我还有一个

javascript脚本运行,可以旋转3个图像并淡入它们并且

out。
I have a webpage that has two flash animations running. I also have a
javascript script running that rotates 3 images and fades them in and
out.



哎哟。

Ouch.


要在javascript中进行淡入淡出和旋转我正在使用

setInterval函数,如下所示:


setInterval(function(){imageFade()},10);
To do the fading and rotating in javascript I am using the
setInterval function, like this:

setInterval(function () {imageFade()},10);



没有OS计时器以10毫秒的间隔打勾。

No OS timer ticks in 10-millisecond intervals.


这在Firefox中工作正常,但在IE 7,flash动画缓慢下降了很多,而javascript的褪色/旋转减慢了一些。


IE中似乎存在时序冲突7闪存和

javascript之间。有关如何在IE 7中解决此问题的任何建议?
This works fine in Firefox, but in IE 7, the flash animations slow
down a lot, and the javascript fading/rotation slows down some.

There seems to be a timing conflict in IE 7 between flash and
javascript. Any suggestions on how to fix this in IE 7?



不要将setInterval()用于对时间要求严格的应用程序;使用setTimeout()

代替。谷歌是你的朋友。 [psf 6.1]

PointedEars

-

Prototype.js是由不懂人的javascript的人编写的。 >
谁不知道javascript。不知道javascript的人不是设计使用javascript的系统的最佳建议来源。

- Richard Cornford,cljs,< f8 ** *****************@news.demon.co.uk>

Don''t use setInterval() for time-critical applications; use setTimeout()
instead. Google is your friend. [psf 6.1]
PointedEars
--
Prototype.js was written by people who don''t know javascript for people
who don''t know javascript. People who don''t know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>


这篇关于Internet Explorer中的Flash,Javascript时间冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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