2 Replies Latest reply on Jun 5, 2014 5:05 AM by RandomReado

    HTML content sits on top of Flex application

    RandomReado Level 1

      I'm trying to load a PDF document in my AIR application using the MX:HTML component. When a popup opens, the HTML component's default behaviour is to hide the content when a popup opens and reappear when the popup disappears. This is what I would expect.

      However if the HTML content is reloaded while the popup is open, the HTML content is reappearing automatically and sitting on top of the popup.

       

      I can replicate this behaviour using Flex SDK 4.6, 4.11, 4.12 and 4.12.1.

       

      Is this a normal behaviour? Is there a way to stop this from happening?

       

      Here is some working sample code:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                             xmlns:s="library://ns.adobe.com/flex/spark" 
                             xmlns:mx="library://ns.adobe.com/flex/mx"
                             creationComplete="maximize()">
          <s:layout>
              <s:VerticalLayout/>
          </s:layout>
          <fx:Script>
              <![CDATA[
                  import flash.utils.setTimeout;
                  
                  import mx.managers.PopUpManager;
                  
                  import spark.components.TitleWindow;
                  
                  private function openPopUp():void
                  {
                      var popup:TitleWindow = new TitleWindow();
                      PopUpManager.addPopUp(popup, this, true);
                      PopUpManager.centerPopUp(popup);
                      
                      setTimeout(function():void{html.reload()}, 1000);
                  }
              ]]>
          </fx:Script>
          <s:Button click="openPopUp()" label="CLICK"/>
          <mx:HTML id="html" location="http://www.energy.umich.edu/sites/default/files/pdf-sample.pdf" width="100%" height="100%"/>
      </s:WindowedApplication>
      
        • 1. Re: HTML content sits on top of Flex application
          jfb00 Level 3

          Hi,

          What about if you create a separate title window as: pdf.mxml

          <?xml version="1.0" encoding="utf-8"?>
          <s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:s="library://ns.adobe.com/flex/spark"
                         xmlns:mx="library://ns.adobe.com/flex/mx"
                         width="800" height="600">
          <mx:HTML id="html" location="http://www.energy.umich.edu/sites/default/files/pdf-sample.pdf" width="100%" height="100%"/>
          </s:TitleWindow>
          

          And call the title window as:

          private var pdfWin:PDF = new PDF();

           

          1. private function openPopUp():void 
          2.             { 
          3. PopUpManager.addPopUp(pdfWin, this, true); 
          4.                 PopUpManager.centerPopUp(pdfWin); 

                 } 

           

          popup should be gone when you reload.

          I hope this help.

          Best,

          • 2. Re: HTML content sits on top of Flex application
            RandomReado Level 1

            I don't want to open the PDF in a new window. I have an application where the HTML component sits behind the popup and I'm trying to prevent the HTML component from sitting on top in the event the content is refreshed. It doesn't happen with the Image component; this issue only appears to affect MX:HTML.