Skip to main content
Known Participant
Dec 12, 2013 4:01 PM UTC
Question

HTMLLoader not showing html page

Hi! I've run into some problems using HTMLLoader on Mac OS X so I've created a simple Actionscript Project to test the basic functionality of this class. The code is as follows:

package

{

          import flash.display.Sprite;

          import flash.events.Event;

          import flash.html.HTMLLoader;

          import flash.net.URLRequest;

 

          public class Testhtml extends Sprite

          {

                    public function Testhtml()

                    {

                              var _webView:HTMLLoader = new HTMLLoader();

                              addChild(_webView);

                              var urlrqst:URLRequest = new URLRequest("test.html");

                              _webView.addEventListener(Event.COMPLETE,onLoad);

                              _webView.load(urlrqst);

                    }

 

                    protected function onLoad(event:Event):void

                    {

                              trace(event.target.location);

                    }

          }

}

test.html is just a simple

<!DOCTYPE HTML>

<html>

<body>

          hello

</body>

</html>

When I Debug the project nothing is shown. I can't see the "hello". Can anyone reproduce this issue? (I'm on Mavericks with AIR 3.9)

This topic is closed to new replies. Start a new post to keep the conversation going.

4 replies

Participating Frequently
Feb 12, 2014 11:02 PM UTC

Hi,

I have the same problem. Did you manage to find out a solution or a reason?

Best regards.

Translate
exprpubAuthor
Known Participant
Feb 17, 2014 2:37 PM UTC

It's been a while since I found a way to make it work. By having a look at my code now I can suggest that you try listening for the LocationChangeEvent.LOCATION_CHANGE instead of Event.COMPLETE. For some strange reason the latter is never fired in OS X.

Translate
Participating Frequently
Feb 17, 2014 8:30 PM UTC

Hi,

Thanks for your feedback.

Honestly it did not work, at least for me. Maybe i'm doing something wrong. Like i said before i'm opening a SWF in a native window, and this works fine on windows.
Do you have any out of the box idea?

Thanks in advance.

  var htmlLoader:HTMLLoader;

  htmlLoader = new HTMLLoader();

  stage.addChild(htmlLoader);

  htmlLoader.alpha = 0;

  htmlLoader.width = 1024;

  htmlLoader.height = 730;

  htmlLoader.navigateInSystemBrowser = true;

  var urlrqst:URLRequest = new URLRequest(urlSWF);

  htmlLoader.addEventListener(LocationChangeEvent.LOCATION_CHANGE,onLoad)

  htmlLoader.load(urlrqst);

  private function onLoad(event:flash.events.Event):void

  {

     trace("local " + event.target.location);

   }

Translate