Flash to iOS FAQ

I’ve been asked a number of questions around publishing Flash content to iOS using the Packager for iPhone. The official Packager for iPhone FAQ is located here and is quite useful, but the purpose of this post is to expand on it to answer some specific questions:

General Questions:

  1. How do we get a video to play within the app? FLV with VP6 in software @ 400kb/s or less, and around 200px wide. Full screen and full framerate will be hard to achieve because of performance.
  2. The TransformGestureEvent.GESTURE_SWIPE doesn’t seem to register all the time. Is there a proper way to use it? Make sure you set the input mode to GESTURE:  Multitouch.inputMode = MultitouchInputMode.GESTURE;
  3. What are some of the best optimizing tips? I see that there is a new class called cacheAsBitmapMatrix available to Adobe AIR. Are there any other tips?
  • Consider bitmaps over vectors
  • Keep bitmaps as small as possible
  • Minimize number of vectors
  • Test your animations with different qualities of Stage
  • Avoid, if possible: Filters, Blend modes, Transparency, Perspective distortion, High-frequency timers, UpdateAfterEvent, Set frame rate as low as possible and/or dynamically adjust frame rate: stage.frameRate=15;
  • Use enterFrame event when necessary
  • Consolidate into a single handler instead of multiple ones
  • Thibault Imbert is the Flash Player manager and has written about performance here: http://www.bytearray.org/?p=1363. He is the authority when it comes to performance, if you ask me.
  1. What do we do when we are building for the iPhone 4 and for the iPad to take advantage of their larger resolution displays?  iPad is 1024×768 @ 132ppi and iPhone 4 is 960×640 @ 326ppi.  Take the ppi and multiply by what you need for exact sizes.  For instance, if you want a button that is ½ an inch big then it would be: next_btn.width = Capabilities.screenDPI * .5.  There are basically three resolutions to target: 160ppi, 240ppi, and 320ppi.

Integration with other iOS apps:

  1. Can you open other apps, such as iTunes? In general, no, but there are some exceptions. If the target app registers as a URL handler, the AIR app can open it via navigateToURL(), but we’ve only white-listed certain schemes, like http: and mailto:. Long-term, we plan to open this up further.
  2. Launch the camera from within Flash? Yes, via the CameraUI class.
  3. Retrieve a pic out of the camera roll, and bring it into Flash? Yes, via the CameraRoll class.
  4. Do push notifications? No.
  5. How to prepopulate an email? The mailto: URL allows for prepopulating the subject line.
  6. Can you print from the app? No.
  7. Does Flash give you any control over the multitasking in iOS? AIR apps pause when sent to the background, and stay in memory as long as possible, but have no access to the background processing features.  I personally wouldn’t want that because I don’t want background apps draining my battery. 🙂

error

Enjoy this blog? Please spread the word :)