Chapter 5. HTML Content

Adobe AIR allows a strong integration with HTML content and JavaScript. Thanks to the WebKit open source browser engine embedded in the Adobe runtime, AIR offers a complete and robust HTML renderer and JavaScript interpreter to re-create a browser-like experience. Through the WebKit framework (http://webkit.org/), developers can create an AIR application completely in HTML, JavaScript, DOM, and CSS. In AIR 1.5, the new SquirrelFish JavaScript interpreter from the WebKit project was added. This makes JavaScript code execution extremely fast within AIR.

The core of the HTML and JavaScript environment is represented by the HTMLLoader class, which enables you to specify the HTML content to display in an AIR application. HTMLLoader is part of the flash.html package and is a subclass of the Sprite class that does not implement the UIComponent interface. If you want to use the class in AIR applications created with Flex, you have to extend the UIComponent interface and include an HTMLLoader object.

The HTMLLoader object can also be accessed via JavaScript by using the htmlLoader property of the window object. In HTML windows, the HTMLLoader object contains all the HTML content that is, in turn, contained in a NativeWindow object. Furthermore, the HTMLLoader object provides properties, methods, and events to control how content is loaded and rendered within the AIR application.

When you use HTML content in an application, you need to understand how to interact with ...

Get Adobe AIR 1.5 Cookbook 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.