Jun16
Getting Page Title from the <mx:HTML> Component
I recently found out how to get the title (i.e. the contents of <title>) of the current page in an <mx:HTML> component in Flex. Turns out you have to wait for the complete event rather than the htmlDOMInitialize event or the value is not accessible.
<mx:Script>
<![CDATA[
private function onHtmlComplete():void {
var title:String = html.domWindow.document.title;
}
]]>
</mx:Script>
<mx:HTML id="html" complete="onHtmlComplete()" />
Every time a new page is loaded this event fires and it is possible to get the new title.
Tags: air, Flex
Posted in Adobe AIR, Flex | No Comments »



