Highlighted

iPhone 4 and iPhone 5 - which stage size?

Participant ,
Aug 25, 2014

Copy link to clipboard

Copied

I'm developing an AIR app for iPhone 4 and 5. The app is centered around a video which I have exported in two versions, a 960x640 version for iPhone 4 and an 1136x640 version for iPhone 5.

Ideally, I would like to just detect whether I'm on an iPhone 4 or 5 and then add the right video and play it. However, I don't know how thisis affected by the stage size, which has to be one resolution or the other. I assume that if the stage size is set to 960x640, it will scale up on an iPhone 5 - and scale down on an iPhone 4 if set to 1136x640.

In my situation, how would you solve this problem? Is there a way to prevent scaling and just placing the right video on the stage at 0,0?

TOPICS
Development

Views

895

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

iPhone 4 and iPhone 5 - which stage size?

Participant ,
Aug 25, 2014

Copy link to clipboard

Copied

I'm developing an AIR app for iPhone 4 and 5. The app is centered around a video which I have exported in two versions, a 960x640 version for iPhone 4 and an 1136x640 version for iPhone 5.

Ideally, I would like to just detect whether I'm on an iPhone 4 or 5 and then add the right video and play it. However, I don't know how thisis affected by the stage size, which has to be one resolution or the other. I assume that if the stage size is set to 960x640, it will scale up on an iPhone 5 - and scale down on an iPhone 4 if set to 1136x640.

In my situation, how would you solve this problem? Is there a way to prevent scaling and just placing the right video on the stage at 0,0?

TOPICS
Development

Views

896

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 25, 2014 1
Engaged ,
Aug 28, 2014

Copy link to clipboard

Copied

To prevent scaling:

import flash.display.StageScaleMode;

import flash.display.StageAlign;

stage.scaleMode = StageScaleMode.NO_SCALE;

stage.align=StageAlign.TOP_LEFT;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 28, 2014 0
Participant ,
Aug 28, 2014

Copy link to clipboard

Copied

Thanks. And just to be clear: If I set scaleMode to NO_SCALE, and I play a video of 1136 px width in an app with 960 px stage width, it will show up as fullscreen on iPhone 5?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 28, 2014 0
Adobe Community Professional ,
Aug 28, 2014

Copy link to clipboard

Copied

You will need to look at the stage width and if it's 1136, play the 1136 wide video. If it's 960, play the 960 video. In both cases the video would be a 0,0.

Don't forget to include the Default-568h@2x.png splash screen, without that the iPhone 5 will act like a 960x640 screen.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 28, 2014 0
Participant ,
Aug 28, 2014

Copy link to clipboard

Copied

Right, I'm already detecting the iPhone version, so that part is good. What I meant was actually the canvas width that I set up in Flash Pro - if *that* is 960, and the video is 1136, and the scaleMode is NO_SCALE, the iPhone 5 will show the whole video?

(I don't have an iPhone 5 on my for testing right now, hence all the questions.)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 28, 2014 0
Adobe Community Professional ,
Aug 28, 2014

Copy link to clipboard

Copied

The stage size can be anything at all, it will get resized to either 1136x640 or 960x640, you don't need to detect the iPhone version, just trust the stage size.

There is a resize event that happens when the app starts, or when you change scale modes, you ought to use that before checking the stage size. The scale mode of Flash defaults to showAll, so doing this ought to work:

stage.scaleMode = "noScale";

stage.addEventListener(Event.RESIZE,resize);

function resize(e:Event){

  //now check the stage size

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 28, 2014 0
Participant ,
Aug 28, 2014

Copy link to clipboard

Copied

And just to be clear, are you referring to checking stage.stageWidth when it resizes?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 28, 2014 0
Adobe Community Professional ,
Aug 28, 2014

Copy link to clipboard

Copied

Yes, try that. There is also stage.screenFullWidth, and I get confused when one is better than the other.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 28, 2014 0
Participant ,
Aug 28, 2014

Copy link to clipboard

Copied

Final question - I've been referring to checking the iPhone's 'width' because my app is operating in landscape mode. Does Flash actually consider the phone's normal height the 'width' when the app is a landscape mode app, or is it actually stage.stageHeight that is 960/1136 pixels on iPhones?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 28, 2014 0
Adobe Community Professional ,
Aug 28, 2014

Copy link to clipboard

Copied

If you were using Capabilities.screenResolutionX, Capabilities.screenResolutionY, those would always refer to the width and height of Portrait on iOS. stage.stageWidth is the width in the orientation you have set. So, for your landscape app the width will be the height of Portrait.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 28, 2014 0
Community Beginner ,
Sep 20, 2014

Copy link to clipboard

Copied

Hello developers, I am developing an ios app with a stage size of 640x1136 (in Flash).  I have tested this out on an IPAD and 4s and it appears as I would expect it.  Today, I tested it out on a 5c for the first time and it appears like it does on the 4s.  I was expecting it to appear more stretched, but the area above and below the app is filled in black.  I

In flash cs6, I set my resolution to standard and included the default568@2x.png file.  Is there anything I need to include in the xml file, so that the app appears properly on the 5c (without the black empty areas above and below the app?

Thank you,

Justin

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 20, 2014 0
Adobe Community Professional ,
Sep 20, 2014

Copy link to clipboard

Copied

No need for anything in the XML, other than you would have set the quality to high. You said you did standard, and that may turn out to be the issue. Standard is 1x, and the splash screen is 2x. It's a requirement of the App Store to support both Retina and iPhone 5, so you will need that to be set to high.

The file you added needs to be named correctly. It should be Default-568h@2x.png , you have a lower case D (which may not matter), but also a missing "-".

The image should be 640x1136 too.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 20, 2014 0
Community Beginner ,
Sep 20, 2014

Copy link to clipboard

Copied

Thanks Colin, I was missing the h in the Default-568h@2x.png.  I have changed the resolution to high (I was hoping not to have to do this, as in the past it worked fine for previous apps on high res ipad devices).  It is compiling now so hopefully it works properly. 

Cheers,

Justin

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 20, 2014 0
Community Beginner ,
Sep 20, 2014

Copy link to clipboard

Copied

It worked.....you are awesome.

Justin

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 20, 2014 0
Adobe Community Professional ,
Sep 20, 2014

Copy link to clipboard

Copied

You can disable the iPad 3 Retina with this entry in the XML:

<requestedDisplayResolution excludeDevices="iPad3">high</requestedDisplayResolution>

That way it's Retina for the other devices, but you don't have to suffer the poor performance of the iPad 3 Retina.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 20, 2014 0
Community Beginner ,
Sep 21, 2014

Copy link to clipboard

Copied

It is those little details that Colin and others share with us that makes this forum a great place to access relevant details.  Thanks Adobe and fellow developers for spending time helping us out.

Justin

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 21, 2014 0