Adobe now makes it possible to create applications for the Apple iPhone using the Adobe Flash Platform. You heard right: We're really excited to bring this new capability to Flash designers and developers—the ability to target the iPhone with ActionScript 3 projects. You will be able to test this functionality in the forthcoming beta release of Adobe Flash Professional CS5 on Adobe Labs.
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 over 85,000 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 SWF content into a native iPhone 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 iPhone 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 the iPhone, there is no interpreted code and no runtime in your final binary. Your application is truly a native iPhone app.
So how do you build an application for the iPhone? It's simple, really. The forthcoming beta of Adobe Flash Professional CS5 incorporates the ability to create an iPhone application. You have access to nearly all the AIR 2.0 and Flash Player 10.1 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. For more information see the developer FAQ on Adobe Labs.
Start by creating 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 the iPhone.
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 the iPhone 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. There are many pros and cons to choosing this rendering path, so for more information see the developer FAQ on Adobe Labs.
Once you've built your application, you can deploy your app on the iPhone or iPod touch 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 iPhone application using Flash.
Here's a recap of related resources to check out on Adobe Labs:
We're really looking forward to see what you're going to build!
Aditya Bansod is a senior product manager in the Platform Business Unit at Adobe Systems, where he is responsible for mobile application distribution and platforms in the Adobe AIR product group. Aditya focuses specifically on mobile and converged opportunities that help publishers and developers easily reach a greater audience.