Ver Mensaje Individual
  #3 (permalink)  
Antiguo 27/01/2005, 20:39
Avatar de Bandit
Bandit
Moderador
 
Fecha de Ingreso: julio-2003
Ubicación: Lima - Perú
Mensajes: 16.726
Antigüedad: 20 años, 9 meses
Puntos: 406
Hola JuanSC:
Crea un MC con un rectángulo con relleno del mismo tamaño de tus fotos (todas tus fotos tiene que tener las mismas dimensiones), una instancia de este MC colocas en el escenario en la capa 1 frame 1 y le pones como nombre de instancia: photo.
Crea 2 botones con los títulos Anterior y Siguiente, lo pones en la capa 2 frame 1, ubicándolos debajo del MC.
Crea la capa 3 y en el frame 1 coloca éste código:
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);
}

Como verás aquí está hecho para cargar 9 imágenes.jpg. (bueno, tú le pones la cantidad de fotos que quieres cargar) las cuales tienes que estar en un sub_carpeta que se llame: fotos

Espero haberte sido de ayuda.
__________________
Bandit.
Si no sabes estudia y si sabes enseña.
http://www.banditwebdesign.com/