Skip to main content
Participant
October 30, 2011
Question

HTMLLoader problem

  • October 30, 2011
  • 3 replies
  • 1695 views

hi everyone i have some problem with HTMLLoader

i have this code:

  var htmlLoader:HTMLLoader = new HTMLLoader();

  htmlLoader.loadString("<html><div id='test'>dsf</div></html>");

htmlLoader.addEventListener(Event.COMPLETE,function htmlDOMInitialize(evt:Event):void{

       trace(htmlLoader.window.document.getElementById("test"));

  });

  htmlLoader.addEventListener(Event.HTML_DOM_INITIALIZE,function htmlDOMInitialize(evt:Event):void{

       trace(htmlLoader.window.document.getElementById("test"));

  });

but in this example  COMPLETE and HTML_DOM_INITIALIZE not activate ..  why ??

Regards

This topic has been closed for replies.

3 replies

Inspiring
October 31, 2011

I am not shure this is the rignt way to do ...

usualy you use urlrequest and urlloader... in case you want to load xml or  html... in case you want to load an image you use urlrequest ant loader.

here a sample code

function testNet(): void{

var urlRequest:URLRequest = new URLRequest("http://www.google.com");

var urlLoader:URLLoader = new URLLoader();

urlLoader.addEventListener(Event.COMPLETE, urlLoader_complete);

urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);

urlLoader.load(urlRequest);

function urlLoader_complete(evt:Event):void {trace ( "connection internet");}

function ioErrorHandler(event:IOErrorEvent):void {

            trace("pas de connection internet");}}

testNet();

Participating Frequently
October 31, 2011

Are you doing mobile development? The HTMLLoader class isn't supported in the AIR mobile profile.

Inspiring
November 1, 2011

yes that why you use URLrequest instead