I've converted the iframe demo found in the
HTML in Flex post into an AIR demo. In this post is a badge to install the application, a link to the source, and a list of the differences between the two versions.
A badge to install and run the application is on
this separate page until I can figure out how to get Movable Type to stop entitizing scripts. You can also
view the source of the demo here.
The AIR HTML demo shows how easy it is to switch from using an iframe to
mx:HTML. Of course, it may not be easy to convert some of the particulars of a large application or to convince your boss to use AIR, but the basic conversion only takes a few hours.
Here's what had to change from the iframe demo:
- The IFrame component has been removed and is simply replaced with mx:HTML. The 'source' attribute changed to 'location'.
- No HTML wrapper file is needed, since this is an AIR application. But an AIR badge, not included in these source files, is used to launch the AIR app from a web page. You can find the source to the badge that was used on Adobe Labs.
- Application changed to WindowedApplication, as is needed for all AIR applications.
- HTMLDemo-app.xml was added, the AIR configuration file.
A few more changes were made, additional enchancements that weren't needed for the AIR conversion:
- Cleaned up the MXML, moving code into functions.
- Used the HTML events to show a busy cursor when a page is loading.
- Added back some sites that didn't work in the Flex version.
- Added Wacky HTML mode for the fun of it, to show how easy it is to change the display of HTML in an AIR app.
In case you missed it earlier, note that you can install the application
here.
While I've attended AIRCamp and read a good deal about AIR, this is the first thing I've ever compiled with AIR. So just let me know if I've done anything dumb.