Hi there,
I’ve searched for hours and hours, but I haven’t found an answer to my preloader question. And I’m sorry if it has been asked before…
How do you make a preloader for/with the MovieClipLoader?
I have created a MovieClipLoader and a listener object for it
[AS]
var content_mcl:MovieClipLoader = new MovieClipLoader();
var loadingListener:Object = new Object();
[/AS]
Now I want to make a preloaderbar so the user gets informed of the status of the download, but how should I do this?
I found this on the actionscript.org forum:
[AS]
//Assuming that your code was in the same timeline as _root
//hint: never use _root, use a relative reference
Object.rootMain = this;
my_mc1.load(“home.swf”);
onEnterFrame = function(){
percent = Object.rootMain.calcPercent();
Object.rootMain.loadBar.proc.text = percent;
Object.rootMain.loadBar.gotoAndStop(percent);
if(percent >= 100){
delete onEnterFrame;
}
};
calcPercent:Number = function(){
var loaded = Object.rootMain.my_mc1.getBytesLoaded();
var total = Object.rootMain.my_mc1.getBytesTotal();
// sometimes total will be 0 if this check is made too soon,
// if it is, set it to an arbitrary value to make sure you don’t
// get a false indication that percent = 100
if(total <= 1) total = 100;
return Math.ceil(loaded/total);
};
[/AS]
But I can’t get it to work… Can anyone provide me with some code that does work?
Thanx in advance…
Sintax