Now that you have seen how to use the location property of the HTML component, it would be useful if we could give users the option to move forward or backward throughout their browser history. Fortunately, the HTML component makes this pretty simple. In this section, we will build a basic Web browser with current location as well as forward and back history controls. To get started, create a new AIR project named Chapter15_Browser, which will also create a new file named Chapter15_Browser.mxml. Next, add the contents of Listing 15-3 to the Chapter15_Browser.mxml file.
Listing 15-3 is the base of the browser example with additional functionality to be added within this section. There is a TextInput component that has its text property bound to the location property of the HTML component property. The TextInput component allows the user to type in a URL and then click [Enter], which calls the goToURL() function. The goToURL() function sets the HTML component's location property to the text value of the TextInput component. The Go! button will also call the goToURL() function when clicked. Running the application will result in something similar to Figure 15-3.