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

MovieClip.prototype

Estas en el tema de MovieClip.prototype en el foro de Flash y Actionscript en Foros del Web. He creado un swf con este codigo, lleva un movie clip llamado photo, que lo situo sobre la escena, tambien lleva dos botones.Cuando lo pruebo ...
  #1 (permalink)  
Antiguo 24/04/2005, 03:17
 
Fecha de Ingreso: mayo-2003
Mensajes: 866
Antigüedad: 20 años, 11 meses
Puntos: 0
Pregunta MovieClip.prototype

He creado un swf con este codigo, lleva un movie clip llamado photo, que lo situo sobre la escena,
tambien lleva dos botones.Cuando lo pruebo funciona perfectamente, lo que ocurre es que si cargo
este swf desde otro, no me aparecen las imagenes, ni uncionan los botones.
Desde el swf principal (el que carga a otro swf que contiene el movie clip photo),lo cargo asi:
_root.createEmptyMovieClip("contenedorA5", 5);
loadMovie("galeria.swf", "contenedorA5");
contenedorA5._x = 30;
contenedorA5._y = 210;
No se si la forma correcta de trabajar con MovieClip.prototype es la que he descrito antes!.
Si es correcta, tengo que modificar algo para que funcione.
Este es el codigo del swf:
this.pathToPics = "animation/";
// fill this array with your pics
this.pArray = ["image0.jpg", "image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.jpg", "image6.jpg", "image7.jpg", "image8.jpg", "image9.jpg"];
this.fadeSpeed = 20;
this.pIndex = 0;
// MovieClip methods ----------------------------------
// d=direction; should 1 or -1 but can be any number
//loads an image automatically when you run animation
loadMovie(this.pathToPics+this.pArray[0], _root.photo);
MovieClip.prototype.changePhoto = function(d) {
// make sure pIndex falls within pArray.length
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() {
// specify the movieclip to load images into
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;
}
};


Este es el codigo que llevan los botones:
Retroceder:
on (release) {
_root.changePhoto(1);
}

Avanzar:
on (release) {
_root.changePhoto(1);
}
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 04:27.