1

使用内置的 nativeApplication.idleThreshold 来确定 AIR 应用程序上的非活动状态。当我以桌面为目标时效果很好。但是,当我发布到 iOS 时,它无法正常工作。有谁知道为什么?

NativeApplication.nativeApplication.idleThreshold=4;
                NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.NORMAL;
                NativeApplication.nativeApplication.addEventListener(Event.USER_IDLE, function(event:Event) {
                    if (_mode != Const.IDLE) {
                        _mode=Const.IDLE;
                        sendNote();
                    }
                });
                NativeApplication.nativeApplication.addEventListener(Event.USER_PRESENT, function(event:Event) {
                });
4

1 回答 1

1

它不起作用的原因是因为它是“按设计”的。

如果您查看“userIdle”或“userPresent”的文档,您将看到以下行:“此事件未在移动设备或 AIR for TV 设备上调度”

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/NativeApplication.html#event:userIdle

所以出于某种我无法理解的原因,他们认为没有必要在移动应用程序(iOS、Android、Blackberry)中实现这两个事件。

但我认为它们在移动应用程序中也很有用,所以我提交了功能请求。

请在这里投票,以便他们考虑实施它: https ://bugbase.adobe.com/index.cfm?event=bug&id=3648849

顺便说一句,在您的示例代码中,您使用的是 4 秒阈值,即使在桌面上也无法正常工作,因为最小值为 5。

于 2013-10-14T16:52:39.653 回答