Tag Archives: actionscript

Make your full screen Android apps even fuller screen with the latest update to our Adobe AIR ANE

The first release of our true full screen ANE (http://wp.me/pKrhE-8B) brought non-interactive true full screen to Adobe AIR apps for Android. Now, we’ve taken things one step further and enabled true, interactive full screen on Android 4.4+ using immersive mode.

Required Adobe AIR 4+.

How does it work?

This ANE enables developers to offer users a true full screen experience in the Adobe AIR apps for Android.

Using Android 4.0+, you can use true full screen in “lean mode”, the way you see in apps like YouTube, expanding the app right to the edges of the screen, hiding the status and navigation bars until the user next interacts. This is ideally suited to video or cut-scene content.

In Android 4.4+, however, you can now enter true full screen, fully interactive immersive mode. In this mode, your app will remain in true full screen until you choose otherwise; users can swipe down from the top of the screen to temporarily display the system UI.

Code example

Using the ANE in your app couldn’t be easier:

import com.mesmotronic.ane.AndroidFullScreen;

AndroidFullScreen.hideSystemUI();
AndroidFullScreen.showSystemUI();
AndroidFullScreen.showUnderSystemUI();
AndroidFullScreen.immersiveMode(); // *
AndroidFullScreen.immersiveMode(false); // *

// * = Android 4.4+ only

Most of the new methods are self explanatory, with the new immersiveMode() method used to enter interactive true full screen mode permanently using so-called “sticky” mode and immersiveMode(false) entering true full screen until the user swipes down from the top to show the system UI.

Download

Click here to download the latest release from GitHub

Open source

This source code for this project has been made available on GitHub, under the BSD license.

Enable true full screen in your Android apps with our new ANE for Adobe AIR

One of the most common complaints you hear from Adobe AIR developers is that they can’t get true full screen on Android devices that have an on-screen navigation bar (the one that contains the back, home and task buttons), with full screen usually meaning that the buttons are simply replaced with a series of grey dots.

If you’re one of those developers, then this AIR Native Extension (ANE) may be the solution you’ve been looking for.

This ANE requires Adobe AIR 4+.

How does it work?

This ANE enables developers to offer the same true full screen experience you see in apps like YouTube in their own Adobe AIR apps, expanding the app right to the edges of the screen, hiding the status and navigation bars until the user next interacts with the screen.

This is ideally suited to video or cut-scene content.

Code example

Using the ANE in your app couldn’t be easier:

import com.mesmotronic.ane.AndroidFullScreen;

AndroidFullScreen.hideSystemUI();

If you want to include the ANE in a cross-platform app, you have two options for implementation:

if (!AndroidFullScreen.hideSystemUI())
{
    stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}

or

if (AndroidFullScreen.isSupported)
{
    AndroidFullScreen.hideSystemUI();
}
else
{
    stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}

Starling

To use this ANE with Starling,  add Starling.handleLostContext = true; at the start of your ActionScript code to prevent Stage3D lost context errors breaking your app when switching between the normal app state and true full screen.

What’s next?

In the future, we’ll probably add more of Android’s ImmersiveMode features, like enabling your app to appear behind the user’s status and/or navigation bar.

Download

Click here to download the latest release from GitHub

Open source

This source code for this project has been made available on GitHub, under the BSD license.

How to target legacy versions of Adobe AIR runtime on Android using Flash Builder 4.7 (without using captive runtime)

The problem

Despite Adobe Flash falling out of favour for many web applications, Adobe AIR remains a great option for cross-platform mobile app development and rapid prototyping, and with the advent of captive runtime for Android it’s now possible to distribute apps without having to ask users to download and install the Adobe AIR runtime separately.

However, if you’re looking to distribute a simple experiment or throwaway game that’s just a few 10s of 100s of kilobytes on its own, wrapping it up with a near 10MB runtime isn’t quite as desirable.

So, you can just select “Export application that uses a shared AIR runtime”, right? Sadly not. If you’re targeting the original Kindle Fire (AIR 2.7), any of the Kindle Fire HD range (AIR 3.1), or the Nook HD or HD+ (AIR 3.3) you’ll find that they all come with embedded, non-updateable versions of the Adobe AIR runtime which are at least a few versions older than the AIR SDK used by Flash Builder 4.7 for ActionScript projects (this is how to update it, in case you wondered).

Assuming your app doesn’t use any of the features added in more recent versions of AIR, this is how you can target legacy runtimes using Flash Builder 4.7:

The solution

1. Edit the .actionScriptProperties file

While Flash Builder doesn’t have an option to change the compiler used for ActionScript or ActionScript Mobile Projects, you can switch your project from the new ASC2 compiler to the standard ActionScript Compiler (ASC) by editing your project’s .actionScriptProperties file:

  1. Use Explorer/Finder to navigate to your project folder and locate .actionScriptProperties
  2. Open the file in a text editor, and find/replace useFlashSDK=”true” with useFlashSDK=”false”
  3. Save .actionScriptProperties
  4. Close then open your project using the right-click menu options (or restart Flash Builder)

Now, if you open your project properties in Flash Builder (right click > Properties) and select ActionScript Compiler, you’ll see that you can select which version of the Flex SDK (which includes ASC), and therefore AIR SDK, you’d like to use to compile your project.

2. Add the required SDK(s)

If the SDK you need isn’t listed, Adobe has instructions for adding SDKs to Flash Builder here, and archived versions of both the Flex and AIR SDKs can be downloaded from:

3. Add -swf-version

Once you’ve edited .actionScriptProperties and installed your SDKs, the final step is to ensure that the your project uses the correct SWF version for the target AIR runtime.

To do this, open the ActionScript Compiler properties for your project and add -swf-version=XX on a new line in the “Additional compiler arguments:” text box, where XX is the appropriate number from this table.

4. That’s it!

Just debug and compile your project as before, and you’ll have a nice, tiny APK that works on even the most awkward of devices!

Using shared runtime with AIR SDK 3.7+

If you want to re-enable the ability to package Android apps without the captive runtime using AIR SDK 3.7+, set the AIR_ANDROID_SHARED_RUNTIME environment variable to true.

Device appears to be offline?

If you receive the an error saying “Device appears to be offline. Restarting the device may fix the problem.” while testing or debugging your app in Flash Builder, simply overwrite [legacy_sdk]\lib\android\bin with the same folder from the latest Adobe AIR SDK, or copy aapt.exe, adb.exe, AdbWinApi.dll, AdbWinUsbApi.dll and dx.jar (under lib rep) from [latest_android_sdk]\android-sdk\platform-tools into the folder, overwriting the files that are already in there.