0 Replies Latest reply on Dec 19, 2012 12:35 PM by sgfone

    htmlLoader heights do not get set if next page is a lessor 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="http://ns.adobe.com/mxml/2009" 
                  import mx.events.FlexEvent;
                  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="&lt; Back" 
              <s:Button label="Forward &gt;" 
              <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="http://www.google.com/"/>