Down but not out: Flash in an HTML5 world
Adobe hedges bets with Nitobi
Anyone hoping to pronounce Flash dead as Adobe transitions to the brave new HTML 5 world will have been disappointed, based on the company's MAX Conference last week.
Adobe also talked up Edge, its tool for creating HTML 5 animations which is now in its third preview, and showed CSS Regions and CSS Shaders, two projects it has worked on in the form of contributions to the open source Webkit HTML engine, and in the case of CSS Shaders a submission to the W3C.
Bend this: A CSS Shader example showing an unfolding map
CSS Shaders is influenced by the work Adobe did on Pixel Bender for Flash, and enables CSS Filter Effects to be extended with shaders that process the 3D geometry and the colour of pixels.
Is Adobe then retreating from Flash? Not so fast. Certainly there was more HTML content at MAX than in previous years, and these sessions were among the most popular, but if you look in detail at the session list, you will find that Flash predominates. The biggest splashes at the day two keynote were Flash-related.
The Flash content at MAX was dominated by a trio of new technologies delivered in Flash Player 11 and AIR 3. AIR (Adobe Integrated Runtime) creates a means to run desktop and mobile apps that use Flash as a runtime engine.
The first is Stage 3D, formerly known as Project Molehill, a 3D hardware-accelerated API for Flash. An implementation for mobile is expected early next year. Coding for Stage 3D is a specialist task – as with other 3D libraries such as Open GL – but the results are impressive. In the MAX day two keynote Epic Games announced that its Unreal Engine for game developers is coming to Flash. "We chose as our demo a fully playable level from Unreal Tournament 3 and it turned out to look even better than the version we shipped on Xbox 360 and PlayStation 3, with improvements like global illumination, better shadows, and god rays!" said Epic vice president Mark Rein.
A related project is the open-source Starling Framework, which uses Stage 3D for accelerated 2D graphics and is easier to use.
The second key new feature is the Captive Runtime for AIR. This lets you bundle the Flash player into a native executable, in a similar manner to the packager Adobe created for iOS to overcome Apple's Flash ban. The late Steve Jobs may have done Adobe a favour. Despite the inherent inefficiency of shipping each app with its own player, the captive runtime makes AIR more attractive to developers, since from the user's perspective it removes the Flash dependency. Captive Runtime support is in AIR 3 and works for all supported desktop and mobile platforms except iOS, which still has the packager. Currently the iOS packager is apparently better optimised, but this will change in future updates.
Native extensions have an .ANE extension. Internally, a native extension has an ActionScript interface, plus one or more implementations for different platforms. Each implementation is also written in ActionScript, but can also make use of an ExtensionContext class to access native code. The native libraries themselves are typically written in C or C++, or Java in an Android library, though other languages are possible and one of Adobe's examples calls Microsoft .NET. They are not sandboxed. The main limitations are that they cannot re-implement ActionScript classes, and placing native user interface controls on the Flash surface is not supported.
There are several areas where native extensions will prove useful. These are making use of otherwise inaccessible device features, reusing legacy code or existing libraries, and improving the performance of critical code. Since they are easy to distribute and have developer-friendly ActionScript APIs, we can expect to see a proliferation of native extensions some of which will be widely adopted. Taken together, these three technologies make AIR more interesting than before, particularly as a cross-platform mobile toolkit. It is significant that the six new tablet apps, including Photoshop Touch, that were previewed by Adobe at MAX are built with Adobe AIR but delivered using the captive runtime, and make heavy use of native extensions.
What about PhoneGap then, which is also a cross-platform toolkit for mobile? A good question, and one that Adobe will only answer in vague terms. "If you are building a rich game, use Flash. If you are building data-driven applications that are fundamentally pulling source from an end service into an application you can use HTML 5 and PhoneGap to get on those devices," Adobe's senior vice president David Wadhwani told me. Note, though, that he said "can use" to allow for the fact that mobile AIR also covers that second scenario, though currently on a smaller range of devices.
Follow the money
Flash also remains important for web developers who need a consistent cross-browser platform for rich applications. Some came to MAX anxious for reassurance that Flash will not be abandoned. "It would be like returning to the browser wars," one developer told me.
That reassurance was evident at MAX. Flash is not dead, though it is becoming a specialist resource rather than something to stick on web pages to spice them up. Thank goodness. ®
Sponsored: Becoming a Pragmatic Security Leader