The contents of the HTML Document Object Model (DOM) are fully accessible. By accessing the document property of the HTML component's htmlLoader, you will have full access to all of the DOM's properties and methods. This section will demonstrate a few ways to access parts of the DOM. For more information on the properties and methods available, you may reference the WebKit DOM reference at developer.apple.com/documentation/AppleApplications/Reference/WebKitDOMRef/index.html.
To demonstrate a few of the DOM properties and methods, create a new AIR project named Chapter15_DOM, which will create a new file named Chapter15_DOM.mxml. Within this file, please add the contents of Listing 15-7. Listing 15-7 currently has only an HTML component with its location set to www.google.com. The results can be seen in Figure 15-5. We will add to this file in the following sections on accessing the DOM.
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="850" height="700"> <mx:HTML id="html" location="http://www.google.com" width="800" height="509" horizontalCenter="0" y="120"/> </mx:WindowedApplication>