Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/10/2005, 18:03
shadowjecg
 
Fecha de Ingreso: octubre-2005
Mensajes: 4
Antigüedad: 18 años, 6 meses
Puntos: 0
No puedo completar este código...

Saludos.

puse el código siguiente para hacer una galería de fotos y me funciona correctamente:


this.pathToPics = "fotos/";
this.pArray = ["image0.jpg", "image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.jpg", "image6.jpg", "image7.jpg", "image8.jpg", "image9.jpg"];
this.fadeSpeed = 5;
this.pIndex = 0;
loadMovie(this.pathToPics+this.pArray[0], _root.photo);
MovieClip.prototype.changePhoto = function(d) {
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
var p = _root.photo;
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
this.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
this.changePhoto(-1);
} else if (Key.getCode() == Key.RIGHT) {
this.changePhoto(1);
}
};
Key.addListener(this);

Código para el botón Anterior:
on (release) {
_root.changePhoto(-1);
}

Código para el botón Siguiente:
on (release) {
_root.changePhoto(1);
}


Pero me surge una pregunta. Tengo una galería que tiene 250 fotos. entonces con el código anterior puedo ir navegando por ellas, sin embargo, no se detiene en la 250, sino que se cicla y comienza en la foto uno, pero con el número 252. Mi pregunta es: ¿no se le puede dar una instrucción para que se detenga el boton en una determinada foto?, es decir, en este caso, no se puede que cuando llegue a la foto 250, ya no se pueda seguir más adelante?