Chapter 39. HTML Mashups with AIR

Adobe AIR includes functionality to render HTML content in a native application. Unlike traditional Flex applications running in the web browser that require IFrame HTML hacks to overlay rendered HTML in an application, Adobe AIR leverages its WebKit web browser engine for rendering any HTML content, including CSS and JavaScript, inside an AIR application.

Using the Flex mx:HTML tag, both remote and local HTML content can be rendered in an AIR application. Additionally, bidirectional interaction between ActionScript and JavaScript, including HTML DOM manipulation, is available to the developer.

Why Embed HTML in an AIR Application?

With traditional Flex applications running inside a web browser, the developer is limited to rendering HTML to a small subset of HTML tags supported by Flex's Label component through the htmlText property (<a>, <b>, <br>, <font>, <image>, and a few others). There are also workarounds in Flex applications for overlaying an HTML IFrame (provided by the host web browser) over a portion of the visible Flex application, which is crude, but often necessary for displaying complex HTML in an application. With Adobe AIR, these techniques are no longer necessary, as AIR provides a complete implementation of the WebKit web browser (complete with Squirrelfish JavaScript VM) in which any HTML and JavaScript can be rendered and executed (as long as security sandbox constraints are met — more later).

While complete AIR applications can ...

Get Professional Adobe® Flex® 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.