1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
_root.loadMovieClip=function(nom_fichier,niveau)
{
trace("chargement");
_root.barre_chargement.fichier=nom_fichier;
_root.barre_chargement._visible=true;
_root.tdebut=new Date;
mon_mcl = new MovieClipLoader();
_root.mon_mcl.loadClip(nom_fichier, "_level" + niveau);
_root.barre_chargement.niveau=niveau;
_root.barre_chargement._max=taille_max;
_root.i=0;
_root.barre_chargement.onEnterFrame=function()
{_root.i++;
var loadProgress = _root.mon_mcl.getProgress("_level" + this.niveau);
d=new Date;
heure_deb=_root.tdebut.getTime();
temppasse=d.getTime()-heure_deb;
temptotalestime=temppasse*(loadProgress.bytesTotal/loadProgress.bytesLoaded);
temprestantestime=temptotalestime-temppasse;
debit=Math.ceil((loadProgress.bytesLoaded/1024)/(temppasse/1000));
_root.barre_chargement.debit=debit + " Ko/s";
_root.barre_chargement.taille_telecharger=Math.ceil(loadProgress.bytesLoaded/1024) + " Ko"
h=Math.floor(temprestantestime/1000/60/60);
m=Math.floor(temprestantestime/1000/60);
s=Math.ceil(temprestantestime/1000);
h<10?h="0" + h:null;
m<10?m="0" + m:null;
s<10?s="0" + s:null;
_root.barre_chargement.temp_restant=h + ":" + m + ":" + s;
_root.barre_chargement.temp_passe=Math.ceil(temppasse/1000) + " s / " + Math.ceil(temptotalestime/1000) + " s";
_root.barre_chargement.temptotalestime=Math.ceil(temptotalestime);
_root.barre_chargement.taille_totale=Math.ceil(loadProgress.bytesTotal/1024) + " Ko";
if(loadProgress.bytesLoaded!=undefined and loadProgress.bytesTotal!=undefined)
{
ratio=Math.ceil((loadProgress.bytesLoaded*100)/loadProgress.bytesTotal);
_root.barre_chargement.ratio.text= ratio + "%";
}
else
_root.barre_chargement.ratio.text= "0 %";
//_root.barre_chargement.ratio._x=(3*ratio);
_root.barre_chargement.progressbar._width=(temppasse/temptotalestime)*300;
if((loadProgress.bytesLoaded==loadProgress.bytesTotal) and loadProgress.bytesTotal>0)
{
_root.barre_chargement._visible=false;
delete this.onEnterFrame;
_root.chargeur._alpha=100;
}
}
}
_root.loadMovieClip("monurl + loader.swf",1); |
Partager