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:
- 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.
- 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;
- 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.
- 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:
- 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.
- Launch the camera from within Flash? Yes, via the CameraUI class.
- Retrieve a pic out of the camera roll, and bring it into Flash? Yes, via the CameraRoll class.
- Do push notifications? No.
- How to prepopulate an email? The mailto: URL allows for prepopulating the subject line.
- Can you print from the app? No.
- 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.