12 May 2011
In September 2010, Apple announced that it had lifted restrictions on its third-party developer guidelines. This means that you can now create applications for iOS using the Adobe Flash Platform*. You heard right: We're really excited to bring this capability to Flash designers and developers—the ability to build standalone content for the Apple iPhone, iPod touch, and iPad using Adobe AIR included with Adobe Creative Suite CS5.5, Adobe Flash Professional CS5.5, and Adobe Flash Builder 4.5.
As you know, the Apple iPhone is one of the best selling consumer electronic devices of all time, and the fastest selling smartphone ever. The popularity of the device among developers and consumers created an explosion of currently over 350,000 iOS applications that captured the attention of consumers around the world.
Flash developers told us how eager they were to create apps for the App Store, so we sought a way to make it easy for our community to bring their knowledge and creative talents there. After looking at the software terms, agreements, and allowable content that Apple permits in the store, we decided that our best option was to provide our developer community with a compiler to help package their AIR application into a native iOS application. (Of course, we made sure we did this in a way that aligned with Apple's legal terms.)
We enabled this by using the Low Level Virtual Machine (LLVM) compiler infrastructure. LLVM is a modular, flexible compiler system that is used widely in a variety of projects. The key reason we choose LLVM is its flexibility and applicability to iOS development.
We created a new compiler front end that allowed LLVM to understand ActionScript 3 and used its existing ARM back end to output native ARM assembly code. We call this Ahead of Time (AOT) compilation—in contrast to the way Adobe Flash Player and Adobe AIR function on the desktop using Just in Time (JIT) compilation. Since we are able to compile ActionScript to ARM ahead of time, the application gets all the performance benefits that the JIT would offer and the license compliance of not requiring a runtime in the final application.
By doing the compilation step, we allow developers to create applications using their Flash skills and their knowledge of ActionScript 3. In the process, we also expose the APIs that developers are familiar with so they can not only use the ActionScript language but follow the customary app-building model. When you build your application for iOS, there is no interpreted code and no runtime in your final binary. Your application is truly a native iOS app.
Adobe Flash Professional CS5.5 lets you publish your ActionScript 3 projects to run as native apps on iOS. You will have access to nearly all the AIR 2.6 and Flash Player 10.2 APIs. For example, you can use APIs such as RTMP, Remote Shared Objects, and AMF as well as AIR APIs like SQLite and filesystem access.
Here's how you would go about developing an iPhone app, for example. First, create your application on the desktop that fits the screen size of the iPhone. The iPhone's display (like many smartphones) is 320 × 480. When the app is not in full-screen mode, 20 pixels are taken up by the status bar, so consider that when building your application.
Second, your finger is your pointing device. You can use mouse events (and touch events) to track the user's intent, but remember that the finger is an inaccurate pointing device. Sometimes a finger goes down on the screen but moves up elsewhere. Certain behaviors that you may often employ in desktop application development will not necessarily apply to iOS devices.
The third and most important consideration when building your application is performance. Performance, performance, performance! The iPhone is most decidedly not a desktop computer. It has very powerful and sophisticated hardware, but there is a wide spectrum of capabilities between the different generations of device, the amount of memory available, and the amount of processing power your application has at its disposal.
If you have any experience developing applications with Adobe Flash Lite or other mobile platforms, you can use many of the same tricks and techniques—such as caching bitmaps, limiting the display list depth, and so on. In order to make development of high-performance applications easier, applications built for iOS devices also can take advantage of an augmented rendering pipeline that uses OpenGL ES. This augmented rendering pipeline enhances the Flash rendering model to allow developers to take advantage of the GPU on iPhones. By enabling this rendering path, you have the ability to modify your display objects to put them on a hardware surface.
Once you've built your application, you can deploy your app on iOS devices for testing and tweaking via iTunes. Once you're satisfied with your application, sign it with your distribution certificate and upload it to iTunes Connect. That's it! You've made an iOS application using Flash Professional.
Check out this series of articles to help you learn more about developing for iOS using Flash Professional: