Skip navigation
Currently Being Moderated

htmlLoader heights do not get set if next page is a lessor height

Dec 19, 2012 12:35 PM

Tags: #air #flex #height #height_changes #height?

I have a small AIR app (Flash Builder 4.6) that loads HTML pages.  I am checking the height and find that the clientHeight or contentHeight or height get changed if the page is longer (a greater height) but does not change if the height is less.  I have included a test app I wrote to understand why my production app was not finding the correct height of the loaded page.  I have interogated/debugged the many, many heights in the htmlLoader DOM as well as AS3 heights - all to no avail.  Here is the example code I am using - thanks for any help/direction.


<?xml version="1.0" encoding="utf-8"?>
<!-- aircomponents/src/HTMLSimple.mxml -->
<s:WindowedApplication xmlns:fx="" 


            protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
                content.addEventListener(Event.HTML_RENDER, onHTMLrender); 
                content.addEventListener(Event.HTML_BOUNDS_CHANGE, onHTMLboundsChange);  
                content.addEventListener(Event.LOCATION_CHANGE, onHTMLlocationChange);

            protected function btnDebug_clickHandler(event:MouseEvent):void
                trace("in btnDebug");

            protected function onHTMLrender(event:Event):void
                trace("evt.currentTarget.contentHeight is: " + event.currentTarget.contentHeight);

// FUNCTION onHTMLboundsChange              
            private function onHTMLboundsChange(event:Event):void
                trace("in bounds change");

            private function onHTMLlocationChange(event:Event):void
                trace("in location change");


        <!-- Place non-visual elements (e.g., services, value objects) here -->


    <s:Button id="btnDebug"  click="btnDebug_clickHandler(event)"/>
    <mx:ControlBar width="100%"> 
        <s:Button label="< Back" 
        <s:Button label="Forward >" 
        <s:TextInput id="address" 
                     text="{content.location}" width="100%"/> 
        <s:Button label="Go!" 
                  click="content.location = address.text"/> 
    <s:Group width="100%" height="100%"> 
        <mx:HTML id="content" location=""/> 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points