Thursday, April 19, 2012

Testing a Flex app for iPad3

Testing a Flex app on the iPad3 (sorry, "The New iPad") isn't quite the no-thought-just-works proposition it is on the 2'nd gen device.  The 3rd gen iPad has a portrait resolution of1536x2048, which means it doesn't fit on my screen when I test on the desktop.
When testing on the device, you can get AIR to recognize the right resolution by pointing Flash Builder to the iOS 5.1 SDK, but that only works when you build an IPA using the "slow" method.  When I use the "fast" compile, the app treats the screen as 768x1024.  Meaning I only see the top left 1/4 of my app.

So in order to test I do the following:

1. I target the regular iPad in my debug configuration.  That sets the resolution to 768x1024 at a DPI of 132 (which Flash treats the same as 160).

2. I set applicationDPI="360" in the main application tag of my app.  Since the application DPI is double the screen DPI (which we set to 160 by choosing to target the original iPad), Flex scales everything down by 50%, even single-resolution bitmaps and hard-coded x and y values.  So I can run it on the desktop, or fast-publish to the device and everything fits and is in the proper proportions. ...except button text.  That doesn't get scaled down, so the buttons look weird.  But it's good enough to test against.

3. When I want to publish using the slow method, or do a release build, I remove the applicationDPI="360" from the Application tag.  Otherwise Flex would scale the app down to fit in a 768x1024 space in the top left hand corner of the screen, even though it sees the full 1536x2048 resolution.

Update:  A better solution is to create a custom RuntimeDPIProvider.

1 comment:

  1. Stringfield, as a future homeowner, mentioned she was doubtful at first. When she was informed that her home would be built with a 3D printer, she mentioned she was nervous outcome of|as a outcome of} the strategy was so not often used. She winter scarves for women remembers her great-grandmother’s concrete home was always chilly, but she decided to follow in her footsteps. Organizations like Habitat for Humanity are betting that 3D printing could assist alleviate the elevated demand for low-cost housing. In March, Palari Homes and the construction firm Mighty Buildings introduced a $15 million deliberate neighborhood of greater than a dozen 3-D printed houses in Rancho Mirage, Calif.