True fullscreen for Android games developed in AS3

I came across this awesome extension, to enable true full screen mode for android applications developed in AS3. You can find the extension here.

Sample code:

import com.mesmotronic.ane.AndroidFullScreen;
AndroidFullScreen.isSupported; // Is this ANE supported?
AndroidFullScreen.isImmersiveModeSupported; // Is immersive mode supported?
AndroidFullScreen.immersiveWidth; // The width of the screen in immersive mode
AndroidFullScreen.immersiveHeight; // The height of the screen in immersive mode

AndroidFullScreen.hideSystemUI(); // Hide system UI until user interacts
AndroidFullScreen.showSystemUI(); // Show system UI
AndroidFullScreen.showUnderSystemUI(); // Extend app underneath system UI (Android 4.4+)
AndroidFullScreen.immersiveMode(); // Hide system UI and keep it hidden (4.4+)
AndroidFullScreen.immersiveMode(false); // Hide system UI until user swipes from top (4.4+)

Note: You need to set ‘fullscreen’ to  false in the application descriptor to prevent clipping of flash graphics in place of system UI.

Use immersiveWidth and immersiveHeight property of the extension to get the width and height of the screen after UI is hidden.

If you are using Starling fullscreen extension, you have to pass the immersiveWidth, immersiveHeight as the values for width and height.

var mStarling:Starling = FullScreenExtension.createStarling(Game, stage, AndroidFullscreen.immersiveWidth, AndroidFullscreen.immersiveHeight, HAlign.LEFT, VAlign.TOP);

Leave a comment