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.
North America
Europe, Middle East and Africa
Asia Pacific