因此,自 10.1 版本以来,Flash 播放器中出现了一项新“功能”,当应用程序窗口不在视图中时,该功能会将播放器的帧速率降低至 2 fps。这对于性能来说是个好消息,但它可能会破坏某些功能,例如 Timer 类。
我有一个使用计时器来显示倒计时的应用程序。鉴于应用程序的性质,即使用户不在场,计时器也需要完成倒计时。想象一下,您只需要给用户 10 秒的时间来执行任务。如果用户在计数器中途最小化窗口,他们可以想花多少时间就花多少时间,并且当他们返回窗口时仍有 5 秒的时间。对于较新的 Flash 播放器来说,这显然是无法避免的。
在Air应用程序中,可以设置backgroundFrameRate属性来防止这种行为,但这是WindowedApplication类的一部分,因此它似乎在Web应用程序中不可用。有谁知道即使窗口不可见也能保持恒定帧速率的方法?谢谢
So there's been a new "feature" in the flash player since version 10.1, which reduces the player's framerate to 2 fps when the application window is out of view. This is good news for performance, but it can break some functionality, such as the Timer class.
I have an application which uses a Timer to display a countdown. Given the nature of the application, it is required for the Timer to complete its countdown even if the user is not there to see it. Imagine that you need to give the user only 10 seconds to perform a task. If the user minimizes the window halfway through the counter, they can take as much time as they want and still have 5 seconds left when they return to the window. This apparently can not be avoided with the newer flash players.
In Air applications there is the backgroundFrameRate property which can be set to prevent this behavior, but this is part of the WindowedApplication class, so it seems that it is not available in a web application. Does anyone know a way to keep a constant frame rate even when the window is not visible? Thanks
发布评论
评论(3)
将嵌入的 swf 的 wmode 参数设置为不透明将防止帧速率限制。
布莱恩
Setting the wmode parameter of the embedded swf to opaque will prevent the framerate throttling.
Brian
我自己没有尝试过,但也许您可以尝试强制关闭帧速率:
让我知道这是否有效。
I've not tried myself, but maybe you can try to force the framerate onDeactivate:
Let me know if this works.
测试:
[...]
清楚地表明,当您看到闪光时,tf 会附加等于您的 FPS 的数字。如果计时器与 FPS 一起更改,则最小化窗口时您不会看到差异。但是,回来后您会看到 2 2 2 2 2,即 FPS 下降到 2。AsTheWormTurns
的 onDeactivate 解决方案不起作用。事件已触发,但 fps 未更改。
Brian Bishop 先生的 wmode=opaque 解决方案不起作用,太
明显了,无法尝试:更改 onEnterFrame 函数来设置 FPS:
显然,当闪光灯不可见时,您无法设置 FPS!好吧,除非将其设置为 1,否则您无法设置 FPS。
解决问题的方法很简单,只需制作另一个与上面类似的计时器,但带有附加条件:
E:您可以在此处阅读相关内容:http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c36cfb8137124318eebc6-8000.html
Testing with:
[...]
shows clearly, that when You see the flash, tf appends numbers equal to Your FPS. If timer would get changed together with FPS, You wouldn't see a difference when minimizing a window. But, coming back You see 2 2 2 2 2, that is, FPS dropped to 2.
onDeactivate solution by AsTheWormTurns doesn't work. Event is fired, but fps not changed.
wmode=opaque solution by Mr Brian Bishop doesn't work too
something obvious to try: change onEnterFrame function to set FPS:
Obviously You can't set FPS when flash is not visible! Well, You can't set FPS unless You set it to 1.
Workaround to Your problem is simple, just make another timer similar to this above but with additional conditional:
E: You can read about it here: http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c36cfb8137124318eebc6-8000.html