I have a program in which I found at some random place on the web that preloads external flash files through an URL var. It all works fine but it could be better. I’d like it to have a percentage loaded, the filesize, a cleaner loading bar, and things of that nature.
Is there something similar to this with some of the features I’d like?
Here’s the source code to those interested:
Stage.addListener(this)
this.onResize=function()
{
this.preloader_mc._x=(Stage.width/2)-(this.preloader_mc._width/2)
this.preloader_mc._y=(Stage.height/2)-(this.preloader_mc._height/2)
}
Stage.scaleMode="noScale"
this.onResize()
this.createEmptyMovieClip("holder_mc",1)
holder_mc.loadMovie(movie)
holder_mc.onData=holder_mc.onLoad=function()
{
this._visible=false
}
preloader_mc.onEnterFrame=function()
{
var mc=this._parent.holder_mc
var percent=(mc.getBytesLoaded()/mc.getBytesTotal())*100
if(isNaN(percent)) percent=0
this.bar_mc._width+=(percent-this.bar_mc._width)/7
if(Math.ceil(this.bar_mc._width) == 100)
{
mc._visible=true
this._visible=false
delete this.onEnterFrame
}
}
_global.s_onLoad=function(f)
{
if(onLoadManager == undefined)
{
_global.onLoadManager={};
}
onLoadManager[this] =f;
}
_global.g_onLoad=function()
{
return onLoadManager[this];
}
_global.s_onData=function(f)
{
if(onDataManager == undefined)
{
_global.onDataManager={};
}
onDataManager[this]=f;
}
_global.g_onData=function()
{
return onDataManager[this];
}
MovieClip.prototype.addProperty("onLoad", g_onLoad, s_onLoad);
MovieClip.prototype.addProperty("onData", g_onData, s_onData);
Attatched is the FLA.