Skip to main content
November 28, 2012
Question

Launch image VS SplashScreenImage on iPhone5

  • November 28, 2012
  • 1 reply
  • 2207 views

Hi!

I developed an app for iOS and Android. The app is working fine, but as everyone else, I too have a problem with adjusting the app for iPhone5 😕😕

I'm working on FlashBuilder 4.6 with Adobe AIR SDK 3.5.0.600 on Windows.

First, I have to say that I included the Default-568h@2x.png (size 640x1136) in my src folder.

Launch image is appearing OK!

The problem starts when I want to display my SplashScreenImage...

Here's what I've done so far :

1. I'm using populary called DynamicSplashScreenImage.mxml that looks like this :

<s:SplashScreenImage xmlns:fx="http://ns.adobe.com/mxml/2009"

                                                   xmlns:s="library://ns.adobe.com/flex/spark">

 

          <!-- Default splashscreen image. -->

          <s:SplashScreenImageSource

                    source="@Embed('assets/splash/splash_160.png')"/>

 

          <s:SplashScreenImageSource

                    source="@Embed('assets/splash/splash_240.png')"

                    dpi="240"/>

 

          <s:SplashScreenImageSource

                    source="@Embed('assets/splash/splash_320.png')"

                    dpi="320" />

 

          <s:SplashScreenImageSource

                    source="@Embed('assets/splash/splash_320_i5.png')"

                    dpi="320" minResolution="1000" />

 

</s:SplashScreenImage>

So, I'm using the "minResolution" property to make the diference between iPhone4 and iPhone5 display.

This, unfortunately doesn't seam to work as it should... 😕😕

Could someone please help me on this?

Thanks!

This topic has been closed for replies.

1 reply

Known Participant
December 3, 2012

Same issues here. My launch image displays properly on iPhone 5, but immediately loads the splash image with white bars at the top and bottom despite having a similar setup in my dynamicsplashscreen.mxml file.  It seems to me that it's loading the iPhone 4 version instead. Is there anyway to get what value the minResolution is returning in the SpaslhScreenImage file?

Known Participant
December 3, 2012

Okay, I ended up creating a DynamicSplashScreen Class in ActionScript and it looks like it's working. I changed the splashScreenImage property in my default mxml file to point to the new Actionscript class. While debugging it, I noticed it seems to call getImageClass 2x and the first time through the resolution is always 1000 - even on the iPhone 4. Not sure why this is happening, but I wanted to point it out. The only thing that I noticed is that when viewing on an iPhone 5/iPod Touch 5, I noticed that there is a slight shift with the image after a second. I am assuming that it is moving from the launch image in the src directory to where I have the splash image in the assets folder. Haven't found a way to fix this yet. There might be a better way to do this, but for now this should hopefully work!

package views

{

    import flash.display.StageAspectRatio;

    import spark.preloaders.SplashScreenImage;

    import spark.preloaders.SplashScreenImageSource;

    public class DynamicSplashScreenImage extends SplashScreenImage

    {

        protected var s1:SplashScreenImageSource = new SplashScreenImageSource()

        protected var s2:SplashScreenImageSource = new SplashScreenImageSource();

        protected var s3:SplashScreenImageSource = new SplashScreenImageSource();

        [Embed(source='assets/Default.png')]

        protected var s1Source:Class;

        [Embed(source="assets/Default@2x.png")]

        protected var s2Source:Class;

        [Embed(source='assets/Default-568h@2x.png')]

        protected var s3Source:Class;

        public function DynamicSplashScreenImage()

        {

            super();

        }

        override public function getImageClass(aspectRatio:String, dpi:Number, resolution:Number):Class

        {

            var splashClass:Class;

            s1.source = s1Source;

            s2.source = s2Source;

            s2.minResolution = 920;

            s2.aspectRatio = flash.display.StageAspectRatio.PORTRAIT

            s3.source = s3Source;

            s3.minResolution = 1096;

            s3.aspectRatio = flash.display.StageAspectRatio.PORTRAIT

            switch(resolution){

               // iphone 5

                case 1096:

                    splashClass = s3Source;

                    break;

               // iPhone 4

                case 920:

                    splashClass = s2Source;       

                    break;

               //iPhone 3

                default:

                    splashClass = s1Source;

                    break;

            }

            return splashClass;

        }

    }

}

Hope this helps!

iyyappans
Participant
July 11, 2013

Hi slebang,

I also have the same issue when working for iPhone5. Thank very much for this answer. Its worked fine when I have changed splashscreen.mxml file to dynamic action script file. Later I have modified  splashscreen.mxml file with your logic also working fine.

<?xml version="1.0" encoding="utf-8"?>

<s:SplashScreenImage xmlns:fx="http://ns.adobe.com/mxml/2009"

                     xmlns:s="library://ns.adobe.com/flex/spark">

    <fx:Declarations>

        <!-- Place non-visual elements (e.g., services, value objects) here -->

    </fx:Declarations>

    <s:SplashScreenImageSource

        source="@Embed(source='assets/images/splash_screen_ipad.png')"

        dpi="160"/>

    <s:SplashScreenImageSource

        source="@Embed(source='./assets/images/splash_screen_iphone.png')"

        dpi="320"/>

    <s:SplashScreenImageSource

        source="@Embed(source='./assets/images/splash_screen_iphone5.png')"

        dpi="320"

        minResolution="1096"/>

</s:SplashScreenImage>

Thanks

Iyyappan S