Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starling AS3 IOS Splash Screen

I have developed an app in AS3 and Starling to be ported to IOS. I have updated the Default.png image and this works great however my app takes a while to load and a black screen is shown for about 3-4 seconds.

I have looked everywhere for a solution but couldn't find any that work. Does someone have a working solution?

Many thanks

like image 907
puks1978 Avatar asked Jan 19 '26 12:01

puks1978


2 Answers

I'm not sure if there is a neater solution at the moment but what I do is add a bitmap of the default screen to the native flash stage. Then when Starling is ready I remove the bitmap.

So before you instantiate Starling, add the bitmap image to the stage (this will be the Flash stage)

public static var _splash:Bitmap;
//load or embed your bitmap//
addChild(_splash);

Then instantiate and start Starling. e.g.

myStarling = new Starling(Main, stage, null, null, Context3DRenderMode.AUTO, Context3DProfile.BASELINE);
myStarling.stage3D.addEventListener(starling.events.Event.CONTEXT3D_CREATE, function(e:flash.events.Event):void {
// Starling is ready!
myStarling.start();
});

In your root Starling class (in this example it's Main), use an ADDED_TO_STAGE listener and when this is triggered, remove the bitmap.

public function Main() {    
addEventListener(starling.events.Event.ADDED_TO_STAGE, onAdded);
}

private function onAdded ( e:starling.events.Event ):void {
StartUp._splash.parent.removeChild(StartUp._splash);
StartUp._splash = null;
}

In the example above the root document class is called 'StartUp'.

like image 127
crooksy88 Avatar answered Jan 21 '26 06:01

crooksy88


As described by docs there is Default.png used as splash screen in iOS.

like image 37
Lukasz 'Severiaan' Grela Avatar answered Jan 21 '26 07:01

Lukasz 'Severiaan' Grela



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!