开发者

Screen Lock & sound stop iPhone dev (FLASH CS5.5)

开发者 https://www.devze.com 2023-03-16 12:38 出处:网络
I\'m trying to create iPhone apps using Flash CS5.5 and I have a dou开发者_如何学Cbt. I just created a simple app which plays a long sound (more than 5 min).

I'm trying to create iPhone apps using Flash CS5.5 and I have a dou开发者_如何学Cbt. I just created a simple app which plays a long sound (more than 5 min).

When the phone auto-locks, my sounds stop. If I unlock the phone, my audio resumes.

What could I do to avoid the lock, or don't interrupt the sound when the device auto-locks?


[[UIApplication sharedApplication] setIdleTimerDisabled:YES]

set this for stoping lock the screen.


set this for stoping to lock the screen in ActionScript 3.0,

Import classes:

import flash.desktop.NativeApplication 
import flash.desktop.SystemIdleMode;

NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;

Don't forget to check

WAKE_LOCK

in the permission in AIR settings,

Screen Lock & sound stop iPhone dev (FLASH CS5.5)

If you want normal then use,

NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.NORMAL;


To avoid the lock, you can look at idleTimerDisabled of UIApplication property. Or to run the sound even if the screen is locked, check the link below:

AVAudioPlayer will not play when device is locked

0

精彩评论

暂无评论...
验证码 换一张
取 消