allora, non ho trovato nulla che potesse andare bene al caso mio.
Ho trovato questo preload a barra che non riesco proprio a capire e quindi a modificare come serve a me. Posto il codice:
nel primo frame ho questo codice:
Codice PHP:
//Calculates the amount to load and how much is loaded
percentLoaded = Math.round(_root.getBytesLoaded() / _root.getBytesTotal()*100);
//Sets the width of the bar
this.myWidth(this.loadBar,percentLoaded*1.94);
this.myMove(this.mc_loadNum,percentLoaded*1.9-8);
loadNum.text = percentLoaded +"%";
// FUNCTIONS
function myWidth(moveObj, newWidth) {
moveObj.w = moveObj._width;
moveObj.dwidth = newWidth+moveObj.w;
moveObj.t = 0;
NFRAMES = 10;
moveObj.onEnterFrame = function() {
if (moveObj.t++<NFRAMES) {
moveObj._width = easeOutQuad(moveObj.t, moveObj.w, moveObj.dwidth, NFRAMES);
} else {
delete this.onEnterFrame;
}
};
}
function myMove(moveObj, newX) {
moveObj.x = moveObj._x;
moveObj.dx = newX-moveObj.x;
moveObj.t = 0;
NFRAMES = 8;
moveObj.onEnterFrame = function() {
if (moveObj.t++<NFRAMES) {
moveObj._x = easeOutQuad(moveObj.t, moveObj.x, moveObj.dx, NFRAMES);
} else {
delete this.onEnterFrame;
}
};
}
easeOutQuad = function (time, beginX, changeX, durationX) {
if ((time /= durationX/2)<1) {
return changeX/2*time*time+beginX;
}
return -changeX/2*((--time)*(time-2)-1)+beginX;
};
nel secondo frame ho:
Codice PHP:
if (percentLoaded < 100) {
gotoAndPlay("loading");
}
e nel terzo frame ciò che deve apparire nel filmato.
Vorei poter modificare questo codice in modo da allungare la barra di caricamento (nel caso del codice la barra è molto piccola, circa 20 px). In realtà sono riuscito ad allungarla modificando il valore 1.94 della seconda stringa, impostandolo a 100:
Codice PHP:
this.myWidth(this.loadBar,percentLoaded*1.94);
ma comunque la barra mi va a scatti quando deve arrivare a 100. Allora ho pensato di aumentare il numero NFRAMES nella funzione myMove(moveObj, newX),ma il filmato passa subito al terzo frame senza che la barra sia stata caricata per tutta la lunghezza che vorrei.
C'è quindi un modo per far sì che la barra carichi uniformemente per tutta la sua lunghezza?