Adobe AIR 应用程序在空闲时间后响应缓慢

发布于 2024-08-31 06:52:47 字数 742 浏览 2 评论 0原文

我花了数百美元使用 Flex 4.0 开发 Adob​​e AIR 应用程序,现在我想我应该已经完成​​了,但在让应用程序运行几个小时以上后,UI 响应能力开始缺乏......

我做了什么: 我的应用程序通过将具有透明度的背景图像设置为窗口模块中的 BorderContainers 来使用自定义镶边。我打开了许多不同的弹出窗口,它们都基于窗口类(不是 TitleWindow!),并在 ActionScript 中动态创建和关闭。通过使用 Flex Profiler,我当然知道垃圾收集器会正确销毁所有分配的资源,并且内存消耗不会随着应用程序的正常运行时间而增加。此外,分析器向我显示,我的方法都没有占用大量的 CPU 时间,所以这也应该没问题。

真正有趣的是: 如果我持续与应用程序交互(单击按钮、写入文本……),则什么也不会发生,一切都很好,但是如果我几分钟不与应用程序交互然后回来 - UI 响应能力真的很差!

非常糟糕的意思是,如果我在 TextInput-Control 中输入一些文本,我可以看到每个字母的写入过程至少有 1 秒的延迟!

有没有人遇到过类似的情况,或者知道的人,可能是什么问题? 我的建议是,在进行某些活动后,flash-player-runtime 会限制 AIR 应用程序的 cpu 使用率,并且在用户返回时不会恢复全部功能。

我使用 Flex 4.0、Flex 4.1、AIR 1.5、AIR 2.0 和 Flash Player 9 以及在 Windows XP 和 Windows 7 上运行的 Flash Player 10 测试了该应用程序...

I spent hundreds of ours developing an Adobe AIR Application with Flex 4.0 and now I thought I should have finished, but after letting the application run for more than a few hours the UI-responsiveness begins to lack...

What I do:
My application uses custom chromes by setting backgroundImages with transparency to BorderContainers within Window-modules. I open up many different popups, which all are based on the Window-Class (not TitleWindow!) and created and closed dynamically in ActionScript. By using the Flex Profiler I certainly know, that the garbage collector destroys all the allocated ressources correctly, and the memory consumption does not rise with application uptime. Further the profiler shows me, that none of my methods occupate extensive cpu-time, so this also should be ok.

What is really interesting:
If I continously interact with the application (click buttons, write text,...) nothing happens and everything is fine, BUT if I do not interact with the application for several minutes and then come back - the UI-responsiveness is really poor!

Really poor means, that if I type some text into a TextInput-Control, I can watch every single letter being written with a delay of at least 1 second!

Has anyone experienced a similar situation, or someone who knows, what the problem could be?
My suggestion is, that after some activity the flash-player-runtime limits the cpu-usage of the AIR application, and doesn't give back full power when the user returns.

I tested the application with Flex 4.0, Flex 4.1, AIR 1.5, AIR 2.0 with Flash Player 9 and also Flash Player 10 running on Windows XP and Windows 7...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷离° 2024-09-07 06:52:47

我终于找到了解决方案!

Flex 4 中引入的新 Spark 组件向 WindowedApplication 类添加了一个名为“backgroundFramerate”的属性。默认情况下,此属性设置为 1,这意味着当主 (!) 应用程序窗口处于非活动状态时,AIR 会自动限制帧速率。不幸的是,这个帧速率用于整个应用程序,包括所有其他可能位于前台且处于活动状态的窗口实例!

通过将backgroundFramerate-property设置为-1来禁用自动帧率限制后,所有问题都消失了!

尽管我知道,启动新的窗口派生对象来显示弹出窗口,但我相信这是 Flex 4 中的一个错误,该错误尚未修复。

I have finally found the solution!

The new spark-components introduced with Flex 4 added a property called "backgroundFramerate" to the WindowedApplication-class. By default, this property is set to 1, which means that AIR automatically throttles the framerate when the main (!) application-window get's inactive. Unfortunately this framerate is used for the whole application, including all other window-instances which could be in the foreground and active!

After disabling the automatic framerate-throttling by setting the backgroundFramerate-property to -1 all the problems were gone!

Altough, I know, that instiating new window-derived objects to show popup-windows, I believe that this is a bug in the Flex 4 which is still not fixed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文