I wanted to post some additional information from my sessions at MAX 2011 for those of you who weren’t able to make it. Below you can find my slides, all the links contained in my presentation, and some of the questions (with answers) I received.
Here’s a list of all the links from my slides:
- What’s New in Adobe AIR 3 (ADC article)
- The Starling Framework
- Compass native extension example
- Licensing Adobe AIR applications on Android
- New Audio Capabilities in AIR 3
- How to Correctly Use the CameraRoll API on iPads
- Native Text Input with StageText
- Writing a Cross-platform and Cross-device Application that Browses for Images
- Front-facing Camera Support in AIR 3
- Native JSON Support in AIR 3
- Socket Improvements in AIR 3
- Sign up for the Flash Builder 4.6 prerelease
I got a lot more questions than these, but unfortunately, I don’t remember them all. If you have additional questions, post them in the comments, and I’ll add them to the post.
Q: Can both the front- and rear-facing cameras on a device be active at the same time?
A: Unfortunately, no. Mobile operating systems only allow for one camera to be active at a time. The Flash camera APIs don’t prevent you from trying to open multiple camera streams simultaneously, so this could change in the future (and already works on the desktop with multiple camera), but presently, getting a reference to a camera deactivates any other active cameras.
Q: What does plugging headphones into your phone do to
A: When you plug headphones into a device, the audio from the speakers and the earpiece is piped through the headphone jack. In other words, you can still switch between playing audio through the device’s speakers and earpiece using
SoundMixer.audioPlaybackMode, but it doesn’t really matter because headphones hijack all audio output. (I’ve only tested this on Android so far since my iPhone is back at the office, but I expect the same behavior.)
Q: Is it possible to do rendering from an ANE (AIR Native Extension)?
A: Yes. The supported mechanism for rendering from an ANE is to acquire a reference to a
BitmapData object on the stage, and manipulate the pixels directly. Unsupported mechanisms include anything else clever developers can figure out how to do (I’ve heard a few ideas, but haven’t tried them myself). For more information on ANEs, I recommend Oliver Goldman’s article, Extending Adobe AIR, and Dan Koestler’s article, Developing Native Extensions for Adobe AIR.
Q: If you have to use a
MediaPromise to get images on iOS devices from the
CameraUI rather than getting a reference to the file (see How to Use CameraUI in a Cross-platform Way), how do you get metadata about the photo?
A: You can’t really get much useful information from a file reference pointing to an image, anyway. A
File reference has a few properties like
type, but nothing particularly rich. To get the most interesting photo metadata, extract the EXIF data from the image itself. That will give you things like accurate dates, geographical information, aperture, etc.
Q: Since Flex 4.6 uses
TextInput on mobile and address all the challenges of using
StageText directly, is there any reason to use your
NativeText wrapper around
A: If you’re using Flex, just use the
TextInput Spark component, and everything will be taken care of for you. If you’re building an application in pure ActionScript, I recommend that you use
NativeText, or something similar.
Q: Rather than using the
drawViewPortToBitmapData function of
StageText to create a bitmap copy of the StageText instance, then replacing the StageText instance with the bitmap before placing other Flash content on top, why not just replace the StageText instance with a
A: That would work in theory, however the
drawViewPortToBitmapData function creates a perfect copy of the StageText instance, so the effect of replacing the StageText instance with the bitmap is nearly perfect and seamless. A TextField would almost certainly not be perfect — especially when you try to recreate the border — and therefore the effect would be more jarring. Additionally, for things like scrolling, you may get better performance out of a bitmap than you would out of scrolling a TextField. (Note that the NativeText class discussed here and Flex 4.6 take care of all this for you.)