Skip to main content
Inspiring
August 3, 2011
Question

Creating a universal app for iPad, iPhone, and iPod Touch

  • August 3, 2011
  • 2 replies
  • 1198 views

Hi all,

I'm aware that the screen resolutions for iPhone and iPod are 960x640 (1.5:1), while the iPad's resolution is 1024x768 (1.33:1).

Assuming I'm building an app in landscape mode (built as 1024px wide, then setting the stage to scale down appropriately for smaller screens), it seems there will be more "height," or vertical space on the iPad.

If I kept the stage properties as is, I believe that the iPad would produce a letterbox/widescreen effect to account for the extra space. However, I'd like to build a universal app with a conditional statement, basically saying "if it's an iPad, use a different background and certain graphics."

Is this possible in Flash? I've looked over the forums and didn't see any specific way to tell if the device is an iPad, or if it's an iPhone/iPod. Any other recommendations from those who have successfully created apps for iOS?

Thanks much!

This topic has been closed for replies.

2 replies

Colin Holgate
Inspiring
August 3, 2011

The way I've solved the same issue is to have a 480x320 stage, but with content that goes from -20 to + 340, giving overall content of 480x360. That then exactly fills the regular iPhone, and Retina display, and on the iPad you see the extra content. I made sure important buttons and such were not right at the edges, so they sohwed up fine for both aspect ratios screens.

You could do a similar trick with sizes of 960x640, with content above and below the stage, to give a total of 960x720.

Another part of the trick was to make symbols be at a scaled amount, so that the native size for the symbols was suited to the iPad. That meant things were scaled to 46.875% on the iPhone stage, and would grow to 100% on the iPad.

p-wing47Author
Inspiring
August 3, 2011

Thanks, Colin.

Smart thinking. I might be able to use that for some of my menus, just having extra space on top/bottom that doesn't contain buttons and important elements.

Unfortunately, I've got a few screens where elements need to be right next to the top/bottom edge of the screen. In those cases, I think I'll just create two MC's (one being taller than the other) and tell it to display the appropriate one. For the rest, I should be able to get away with your method. That should save some time!

Thanks again!

Inspiring
August 4, 2011

If you want elements at top/bottom edge of the screen, why don't you place them with top and bottom properties of the UIComponent?

Participating Frequently
August 3, 2011

Hi,

Have you tried flash.system.capabilities.os API? This should tell you the device name and OS version.

Thanks,

Sanika

p-wing47Author
Inspiring
August 3, 2011

Thank Sanika,

Here's the Adobe reference, for anyone else looking:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Capabilities.html

Do you happen know supported values for some of the properties? Since iPad and iPhone share the same developer and OS, do you know what the best way to tell them apart would be? Maybe something as simple as horizontal screen resolution, maybe (>= 1024 meaning iPad, and < 1024 meaning iPhone/iPod)?