13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Working with AIR runtime and operating system information<br />

Getting the runtime version and patch level<br />

Adobe AIR 1.0 and later<br />

The NativeApplication object has a runtimeVersion property, which is the version of the runtime in which the<br />

application is running (a string, such as "1.0.5"). The NativeApplication object also has a runtimePatchLevel<br />

property, which is the patch level of the runtime (a number, such as 2960). The following code uses these properties:<br />

trace(NativeApplication.nativeApplication.runtimeVersion);<br />

trace(NativeApplication.nativeApplication.runtimePatchLevel);<br />

Detecting AIR capabilities<br />

Adobe AIR 1.0 and later<br />

For a file that is bundled with the Adobe AIR application, the Security.sandboxType property is set to the value<br />

defined by the Security.APPLICATION constant. You can load cont<strong>en</strong>t (which may or may not contain APIs specific<br />

to AIR) based on whether a file is in the Adobe AIR security sandbox, as illustrated in the following code:<br />

if (Security.sandboxType == Security.APPLICATION)<br />

{<br />

// Load SWF that contains AIR APIs<br />

}<br />

else<br />

{<br />

// Load SWF that does not contain AIR APIs<br />

}<br />

All resources that are not installed with the AIR application are assigned to the same security sandboxes as would be<br />

assigned by Adobe® Flash® Player in a web browser. Remote resources are put in sandboxes according to their source<br />

domains, and local resources are put in the local-with-networking, local-with-filesystem, or local-trusted sandbox.<br />

You can check if the Capabilities.playerType static property is set to "Desktop" to see if cont<strong>en</strong>t is executing in<br />

the runtime (and not running in Flash Player running in a browser).<br />

For more information, see “AIR security” on page 1065.<br />

Tracking user pres<strong>en</strong>ce<br />

Adobe AIR 1.0 and later<br />

The NativeApplication object dispatches two ev<strong>en</strong>ts that help you detect wh<strong>en</strong> a user is actively using a computer. If<br />

no mouse or keyboard activity is detected in the interval determined by the NativeApplication.idleThreshold<br />

property, the NativeApplication dispatches a userIdle ev<strong>en</strong>t. Wh<strong>en</strong> the next keyboard or mouse input occurs, the<br />

NativeApplication object dispatches a userPres<strong>en</strong>t ev<strong>en</strong>t. The idleThreshold interval is measured in seconds and<br />

has a default value of 300 (5 minutes). You can also get the number of seconds since the last user input from the<br />

NativeApplication.nativeApplication.lastUserInput property.<br />

Last updated 6/6/2012<br />

887

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!