Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/06/2011, 04:04
rege
 
Fecha de Ingreso: noviembre-2009
Mensajes: 41
Antigüedad: 14 años, 5 meses
Puntos: 10
Pregunta cargar jpg de un xml (flash player 6)

Hola, estoy haciendo una galeria con un slide de thubnails.

La carga de los thubnails lo hace desde un xml,
el código de los thumbs me funciona bien a partir de flash player 7, pero necesito que funcione en flash player 6, y no lo logro, alguien podria orientarme?

El xml, lo lee bien, pues si hago un trace del thumb (fn[j].attributes.thumb) para ver si lee bien la ruta y si lo hace, lo que falla es el cargar el jpg.

Código HTML:
Código xml:
<imagenes>
<product tit="imagen1" thumb="img/1.jpg" />
<product tit="imagen2" thumb="img/2.jpg" />
etc...
</imagenes>


Código flash:

// clip que contiene thumbs

lstThumb.onLoadInit = function(mc:MovieClip) {
	var aimg:Tween = new Tween(mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
	mc._width = 50;
	mc._height = 50;
};
mclThumb.addListener(lstThumb);

// xml

var xmlFile:String = "imagenes.xml";
var xmlProd:XML = new XML(xmlFile);

xmlProd.ignoreWhite = true;

xmlProd.onLoad = function(sucess) {
	if (sucess) {
		fn = xmlProd.firstChild.childNodes;
		total = fn.length;
		for (var i:Number = 0; i<total; i++) {
			var btn:MovieClip = menu.thumb.attachMovie("thumb", "thumb"+i, i);
			btn._y = (btn._height+15)*i;
			btn.id = i;

			imagenTH = fn[i].attributes.thumb;
			
			mclThumb.loadClip(imagenTH,btn.img);
		}
	} else {
		trace("Error!");
	}
};

xmlProd.load(xmlFile);

El error viene del "mclThumb.loadClip(imagenTH,btn.img);",
estoy probando con loadMovie pero me da error...

Alguien puede ayudarme?

Gracias de antemano.

---------------------------------

EDITO:

Ya lo he resuelto, no se si hay otra forma mejor pero bueno...
así me funciona, por si a alguien le interesa:

he cambiado mclThumb.loadClip(imagenTH,btn.img) por

Código HTML:
menu.thumb["thumb"+i].loadMovie(imagenTH);


Ahora el problema lo tengo con el título, dentro de thumb tengo un campo dinámico, txt, entonces quiero ponerle el título que le toque a cada uno:

Código HTML:
titProd = fn[i].attributes.tit;
menu.thumb["thumb"+i].txt.text = titProd;
pero no me funciona...

Última edición por rege; 23/06/2011 a las 05:19