Search

 

February 2008
S M T W T F S
« Jan   Mar »
 12
3456789
10111213141516
17181920212223
242526272829  

Tags

Archives


« | Main | »

AIR HTML Control

By Rich Tretola | February 25, 2008
11,945 views

The AIR HTML control is something that is unique to AIR and is very easy to integrate into your application. It can be used to simply load in an external html file by location as shown here:

1
2
3
4
5
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:HTML location="http://blog.everythingflex.com"/>
</mx:WindowedApplication>

OR

It can be used for custom html using the htmlText property as shown below:

1
2
3
4
5
6
7
8
9
10
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
    <![CDATA[
        [Bindable]
        private var htmlString:String = '<table border="1"><tr><td>A table cell</td></tr><tr><td>Another cell</td></tr></table>';
    ]]>
    </mx:Script>
    <mx:HTML htmlText="{htmlString}" width="300" height="300"/>
</mx:WindowedApplication>

Note: The htmlText property will only return a value in the second example. To get the html contents of the the component using location, you will need to do a little hack at this time as shown here.

1
2
3
var str:String = html.htmlLoader.window.document.documentElement.innerHTML;
str = str.replace(/\r/g, File.lineEnding);
str = '<html>' + str + '</html>';

Topics: Adobe AIR | 2 Comments »

2 Responses to “AIR HTML Control”

  1. Daniel Bartlett Says:
    May 6th, 2009 at 8:02 am

    I’ve written a really really simple tabbed browser using the Air+flex+HTML. You can find it at: http://airbrowser.9t9.us/

    Cheers,
    DanB.

    Reply to this comment

  2. Truffle Says:
    July 2nd, 2009 at 3:09 am

    Nice

    Thanks

    Reply to this comment

Comments