Skip to main content
Participant
Oct 30, 2011 9:15 PM UTC
Question

HTMLLoader problem

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 is closed to new replies. Start a new post to keep the conversation going.

3 replies

Inspiring
Oct 31, 2011 12:44 PM UTC

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();

Translate
Participating Frequently
Oct 31, 2011 6:54 PM UTC

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

Translate
Inspiring
Nov 1, 2011 7:54 AM UTC

yes that why you use URLrequest instead

Translate