Foros del Web » Creando para Internet » Flash y Actionscript »

NaN en precarga

Estas en el tema de NaN en precarga en el foro de Flash y Actionscript en Foros del Web. Tengo una especie de galeria de imagenes y quiero poner un porcentaje de carga por foto. El problema es que en el porcentaje me sale ...
  #1 (permalink)  
Antiguo 24/02/2008, 18:05
crg
 
Fecha de Ingreso: febrero-2008
Mensajes: 23
Antigüedad: 16 años, 2 meses
Puntos: 0
NaN en precarga

Tengo una especie de galeria de imagenes y quiero poner un porcentaje de carga por foto.
El problema es que en el porcentaje me sale siempre NaN (Not a Numeric), y no entiendo por que ocurre. Adjunto codigo. Gracias.

obj_xml.onLoad = function(exito) {
//Contenedor para tener las fotos
cuadro._visible=false;
createEmptyMovieClip("mc", 300);
createEmptyMovieClip("mctext",950);
//Creamos un MovieClip para alojar el texto "my_txt" y poderlo superponer a las demas capas
mctext.createTextField("my_txt",950,-10000,-10000,100,100);


if (exito)
{
largo = obj_xml.firstChild.childNodes.length;
tipo = new Array(largo);
titulo = new Array(largo);
nombreimagen = new Array(largo);
nombreimagendetalle = new Array(largo);
referencia = new Array(largo);
capacidad = new Array(largo);
indice = new Array(largo);

cuadro._visible=false;


for (i=0; i<largo; i++)
{

nombreimagen[i] = obj_xml.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue;
nombreimagendetalle[i] = obj_xml.firstChild.childNodes[i].childNodes[1].firstChild.nodeValue;
mc.attachMovie("fotos", "fotos"+i, i);
mc["fotos"+i].createEmptyMovieClip("contiene",0);

mc["fotos"+i].createTextField("por", 1, 200, 200, 100, 100);
mc["fotos"+i].width=50;
mc["fotos"+i]._y = 83*(fila)+55;
mc["fotos"+i]._x = 60*(columna+1);
mc["fotos"+i].contiene.loadMovie("../imgs/"+ nombreimagen[i]);


mc["fotos"+i].onEnterFrame=function()
{
var cargado = this.contiene.getBytesLoaded();
var total = this.contiene.getBytesTotal();
trace("cargado " + cargado);
trace("total " + total);
if (cargado == total && total>50) {

delete this.onEnterFrame;
this.por.removeTextField();
} else {
var porcent = Math.round((cargado*100)/total);
this.por.text = String(porcent);
trace(String(porcent));
}


}



mc["fotos"+i].onRollOver = function ()
{

_global.imagenx=this._x;
_global.imageny=this._y;
//El indice lo obtengo del nombre del boton
cuadro.swapDepths(900);
holder.swapDepths(1000);
mctext.my_txt.swapDepths(950);


holder._visible=false;
holder.loadMovie("../imgs/"+nombreimagendetalle[this._name.substring(5)]);


cuadro._visible=true;
var my_fmt:TextFormat = new TextFormat();
my_fmt.color = 0x000000;
mctext.my_txt.selectable = false;
mctext.my_txt.wordWrap = true;
mctext.my_txt.multiline = true;

mctext.my_txt.html = true;
mctext.my_txt.htmlText = "<p><font face='Arial' size='11' color='#000000'><B>Colección: </B>RCR</font></p><p><font face='Arial' size='11' color='#000000'><B>Titulo: </B>" + this._name + "</font></p>";
mctext.my_txt.setTextFormat(my_fmt);

mctext.my_txt._visible=true;


}
mc["fotos"+i].onRollOut = function ()
{
holder.unloadMovie();
cuadro._height=50;
cuadro._visible=false;
mctext.my_txt._visible=false;

}


}


}
else
{
trace("No se pudo cargar el XML");
}

};
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:56.