Escape the iOS SDK: Building iPhone (and Android) apps via Flash

Developers can in fact use Flash and the similar Corona SDK to create apps for the Apple App Store, as well as for Android

Page 2 of 3

A third path comes from the Corona SDK built by Ansca Mobile, a company created by people who used to work on the Flash team. Although the SDK uses Lua rather than ActionScript as a language, the structure of the applications and the API are very similar to Flash. CEO Walter Luh says, "There are a lot of people who will find it a very easy product to understand."

Both tools also promise cross-platform opportunities. Google has welcomed Flash developers onto Android, as has Hewlett-Packard for the forthcoming WebOS 2.1. Adobe also plans on ensuring that its Flash code will run on the forthcoming RIM PlayBook's BlackBerry Tablet OS. Corona supports both iOS and Android, and it may add other platforms if demand warrants.

Moving Flash apps from the desktop to mobile
These tools will be very tempting for any Flash developer with a pile of code that already runs on the Web.

"In some cases, you can just port them over," says Richard Galvan, a Flash product manager at Adobe Systems. "Update the project for a smaller screen size and then very quickly publish it out for iOS. You can literally take the exact same project and in the next same step publish it out to Android."

Still, he warns that although the Adobe packager will make everything work, there may be UI problems with the ported app. For example, smartphones have small screens and often no keyboards, neither of which desktop Flash apps typically accommodate. Likewise, touch events behave slightly different from mouse clicks. Thus, many desktop Flash apps will require a bit of rethinking of how the user interacts with the code.

There's also a fair amount of rework that needs to be done with the graphics. Although all the artwork will display if ported as is, the scale is often wrong for the smaller devices. Thus, the sprites that are easy for the eyes to see on a PC screen are often too small on an iPhone. The biggest challenges often come because there's much less room on the smaller screen.

Deeper challenges come from the style of art. Some Flash presentations rely on vector art to display the same visuals at many scales. Although this works on the iPhone, its rendering is often noticeably less zippy than pure bitmapped artwork, which is handled by the smartphone's graphic hardware. Setting the cacheAsBitmap property can speed up such vector art's rendering -- this is especially important if the background is vector artwork because the engine re-renders every time a sprite on top of it moves.

Tom Barclay, a project manager at Adobe, says the company is looking at adding more automation to the build process so that the packager tool will instantly rasterize the vector artwork at the right size for the right screens. Developers already know that taking advantage of the extra resolution of the newer iPhones' retina displays requires another set of graphics rendered at higher resolutions. Ideally, the build tool would convert vector images and re-render the bitmaps to take advantage of this higher-resolution display in the future.

How to move to Corona
The challenge of moving to Ansca's Corona is a bit different for Flash programmers because the language, Lua, is not the same as ActionScript. The differences are largely cosmetic, and some report that they just rework their code inline with simple steps like replacing the curly brackets with words like "do."

Ansca's Luh says that porting the code is often simple because the data structures are relatively similar and uncomplicated. For example, Lua offers only one kind of table, a collection of untyped name-value pairs.

| 1 2 3 Page 2
From CIO: 8 Free Online Courses to Grow Your Tech Skills
View Comments
Join the discussion
Be the first to comment on this article. Our Commenting Policies