To conserve battery life, mobile devices lock the screen a short period after they are last touched. However, this can be inconvenient for applications where the user might not be expected to interact with the screen that often.
For applications where this is the case, screen locking can be disabled.
We will be adding code to the skeleton document class created in the previous recipe. If you haven't already done this, then complete the Creating a basic document class recipe before proceeding. Alternatively, using the book's accompanying code bundle, open chapter3\recipe2\bubbles.fla
in Flash Professional and work from there.
Let us write some ActionScript to disable screen locking:
Open the FLA's document class by selecting File | Open (Ctrl+O | Cmd+O) from Flash Professional's drop-down menu. From the file browser select Main.as.
Add the following two import statements to your class:
import flash.display.MovieClip; import flash.desktop.NativeApplication...