Skip to main content
Participating Frequently
June 4, 2013
Answered

Is there a way to make a preloader for htmlLoader?

  • June 4, 2013
  • 1 reply
  • 694 views

I have a htmlLoader in my project, and I want to make a visual loading bar to display before it loads my site, then to disappear when it's fully loaded. Is there a way to do this?

This topic has been closed for replies.
Correct answer kglad

// create a preloaer movieclip

var preloader:MovieClip = new Preloader();

addChild(preloader);

var html:HTMLLoader = new HTMLLoader();

var urlReq:URLRequest = new URLRequest("http://www.adobe.com/");

html.width = stage.stageWidth;

html.height = stage.stageHeight;

html.addEventListener(Event.COMPLETE,loadcompleteF);

html.load(urlReq);

function loadcompleteF(e:Event):void{

    removeChild(preloader);

    preloader=null;

    addChild(html);

}

1 reply

kglad
Community Expert
Community Expert
June 4, 2013

you can detect when loading is complete and "fake" a load progress bar but i don't see any easy way to use a progressevent.

looserlfAuthor
Participating Frequently
June 5, 2013

How could I do this?

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
June 5, 2013

// create a preloaer movieclip

var preloader:MovieClip = new Preloader();

addChild(preloader);

var html:HTMLLoader = new HTMLLoader();

var urlReq:URLRequest = new URLRequest("http://www.adobe.com/");

html.width = stage.stageWidth;

html.height = stage.stageHeight;

html.addEventListener(Event.COMPLETE,loadcompleteF);

html.load(urlReq);

function loadcompleteF(e:Event):void{

    removeChild(preloader);

    preloader=null;

    addChild(html);

}