Hola, estoy haciendo una galería de imágenes que las cargo desde un archivo txt así:
Código:
num=3&img1=imagenes/1.jpg&img2=imagenes/2.jpg&img3=imagenes/3.jpg
Sin embargo cuando quiero meter más imágenes o no me las carga o me da error, por ejemplo suponiendo que quiero meter 6 lo pongo así (lo pongo con salto de linea para no descuadrar el foro):
Código:
num=6&img1=imagenes/1.jpg&img2=imagenes/2.jpg&img3=imagenes/3.jpg&img4=imagenes/4.jpg
&img5=imagenes/5.jpg&img6=imagenes/6.jpg
Y no me va, o me dice que la url no es correcta o no me carga el nº4, 5 o 6.
El script desde donde cargo el archivo y las variables es este:
Código:
//we use the LoadVars to load the external text file data that contains the images
//number and urls
var text_lv = new LoadVars();
text_lv.load("imagenes.txt");
//refer the parent of the object in a property so we can access some function that
//the parent have and inaccessible by the text_lv object.
text_lv.parent = this;
//we use the MovieClipLoader so we can determine the width and height of the
//loaded image so we can perform our animation.
var img_mcl = new MovieClipLoader();
var handler = new Object();
var pos = 1;
handler.ref = imageContainer_mc.imgbg_mc;
//functions-----------------------
handler.onLoadInit = function(target_mc) {
//center the loaded image.
target_mc._x = -target_mc._width/2;
target_mc._y = -target_mc._height/2;
//initialize the _alpha to 0 so we can animate the fade in effect.
target_mc._alpha = 0;
//this function will be explained later.
tween(this.ref, mx.transitions.easing.Regular.easeOut, "_width", this.ref._width, target_mc._width+10, .5, true);
tween(this.ref, mx.transitions.easing.Regular.easeOut, "_height", this.ref._height, target_mc._height+10, .5, true, _root, "finish");
};
handler.onLoadComplete = function(target_mc) {
//do nothing.
trace("image loaded");
};
text_lv.onLoad = function(success) {
if (success) {
trace("text loaded");
this.parent.loadImage(text_lv["img1"]);
} else {
trace("loadin failed");
}
};
//this function is used to load an image in the imageContainer_mc.holder_mc
//clip
function loadImage(path:String) {
img_mcl.addListener(handler);
img_mcl.loadClip(path, this.imageContainer_mc.holder_mc);
}
El problema creo que es del archivo txt, y no se como arregrarlo.