Skip navigation
Currently Being Moderated

Preloading for site isn't work

Jan 11, 2012 1:39 AM

Hello! I try to use anyone of theese codes for the preloading of my site,

but no one works. Can you help me to understand where is a mistake

 

 

 

 

1)this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoading);

this.loaderInfo.addEventListener(Event.COMPLETE, onComplete);

 

 

function onLoading(evt:ProgressEvent):void {

          var loaded:Number = evt.bytesLoaded / evt.bytesTotal;

          percent_txt.text = (loaded*100).toFixed(0) + "%";

};

 

 

function onComplete(event:Event):void {

          this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onLoading);

          this.loaderInfo.removeEventListener(Event.COMPLETE, onComplete);

          gotoAndStop(2);

};

 

 

2)loaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);

loaderInfo.addEventListener(Event.COMPLETE, loadComplete);

function loadProgress(my_content:ProgressEvent):void {

 

          var percent:Number = Math.floor( (my_content.bytesLoaded*100)/my_content.bytesTotal );

          loadPercentText.text = percent + " %";

          mc_bar.width = percent * 3;

}

function loadComplete(e:Event):void {

gotoAndStop(2);

}

loaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);

loaderInfo.addEventListener(Event.COMPLETE, loadComplete);

 

 

Thank you.

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points