B�sicamente, y como dicen los libros de estructura de datos, "divide y
vencer�s". Te recomendar�a que hicieras un prototype para la el easing (con
su propio onEnterFrame). Cuando se termine de cargar, llama a otro prototype
que se ocupa de cargar el swf (tambi�n con su propio onEnterFrame). Y cuando
se termine de cargar a su vez, que llame otra vez al prototype de easing.
Parece un poco l�o, pero lo importante es saber pasar los par�metros
correctamente, y qu� o no hacer cuando se tienen o no. Por ejemplo, te
quedar�a algo as� (me juego el cuello y no lo pierdo a que no funciona, pero
la idea es esta):
MovieClip.prototype.mover = function(acc, dec, destY, destX, pos_final,
archivo) {
this.onEnterFrame = function() {
this.acc = acc;
this.dec = dec;
this.destY = destY;
this.destX = destX;
this.currX = this._x;
this.currY = this._y;
this.diffX = this.destX-this.currX;
this.diffY = this.destY-this.currY;
this.vx = (this.vx+(this.diffX)*1/this.acc)/this.dec;
this.vy = (this.vy+(this.diffY)*1/this.acc)/this.dec;
this._x += this.vx;
this._y += this.vy;
if (Math.round(this._x) == pos_final) {
delete this.onEnterFrame;
if (archivo != undefined) {
contenido.seccion.cargaSeccion(archivo);
}
}
};
};
MovieClip.prototype.cargaSeccion = function(file) {
var p = this;
p.loadMovie(file);
var mc = _root.createEmptyMovieClip("vacio", 10);
mc.onEnterFrame = function() {
carga = int(p.getBytesLoaded()*100/p.getBytesTotal());
if (carga>=100) {
_parent.mover(2.5, 3, 70, pos, (pos+1));
delete this.onEnterFrame;
removeMovieClip(mc);
}
};
};
function mostrar(seccion, pos) {
contenido.mover(2.5, 3, 70, 800, 770, seccion);
}
----- Original Message -----
From: "David Serrano" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 25, 2004 2:08 PM
Subject: [ASNativos] funci�n descompensada en internet: en local bien!!
Buenas, tengo un problemilla y me gustaria que me dieseis alguna idea.
Tengo un menu, que llama a la funcion mostrar. Esta llama a u prototype de
easing, pero me aparece en pantalla de un tiron. He aqui el code:
Movieclip.prototype.mover = function(acc, dec, destY, destX) {
this.acc = acc;
this.dec = dec;
this.destY = destY;
this.destX = destX;
this.currX = this._x;
this.currY = this._y;
this.diffX = this.destX-this.currX;
this.diffY = this.destY-this.currY;
this.vx = (this.vx+(this.diffX)*1/this.acc)/this.dec;
this.vy = (this.vy+(this.diffY)*1/this.acc)/this.dec;
this._x += this.vx;
this._y += this.vy;
};
function mostrar(seccion, pos) {
this.onEnterFrame = function() {
contenido.mover(2.5, 3, 70, 800);
if (contenido._x>=770) {
delete this.onEnterFrame;
contenido.seccion.loadMovie(seccion);
carga =
int(contenido.seccion.getBytesLoaded()*100/contenido.seccion.getBytesTotal()
);
if (carga>=100) {
this.onEnterFrame = function() {
contenido.mover(2.5, 3, 70, pos);
if (contenido._x<=(pos+1)) {
delete this.onEnterFrame;
}
};
}
}
};
}
En local, funciona bien, pero en internet sale del tir�n. Incluso le digo
que hasta que no est� cargada la movie no inicie el moviemiento, pero sigue
saliendo del tir�n. Luego si apretas al mmismo boton, desaparece
normalmente, y aparece bien. S�lo es la primera vez.
Alguna idea?
Saludos y gracias por anticipado.<!-------------------------------
Lista ASNativos:
subscripciones/desubscripciones
http://www.sidedev.net/asnativos
-------------------------------->
<!-------------------------------
Lista ASNativos:
subscripciones/desubscripciones
http://www.sidedev.net/asnativos
-------------------------------->