使用内置的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) {
});发布于 2013-10-15 00:52:40
它不能工作的原因是因为它是“设计出来的”。
如果您查看"userIdle“或"userPresent”的文档,您将看到此行:"This event is not dispatched on mobile device or AIR for TV device“
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/NativeApplication.html#event:userIdle
因此,出于一些我无法理解的原因,他们认为没有必要在移动应用程序(iOS、安卓、黑莓)中实现这两个事件。
但我认为它们在移动应用程序中也很有用,所以我提交了一个功能请求。
请在这里投票,以便他们考虑实施它:https://bugbase.adobe.com/index.cfm?event=bug&id=3648849
顺便说一句,在你的示例代码中,你使用了4秒的阈值,这个阈值即使在桌面上也不会起作用,因为最小值是5。
https://stackoverflow.com/questions/18280831
复制相似问题