¿Por qué sólo funciona onResize?
Hola:
Estoy siguiendo este tuto (http://www.tutorio.com/tutorial/liquid-flash-layout) para hacer un flashh a 100& del browser y consigo que los moviclips se redimensionen a mi gusto en el onResize, pero no me hace caso a las propiedades que inicializo para esos mismos movieclips.
Simplificado, tengo este código:
<code>//the stage will be positined in the topleft corner of the stage
Stage.align = "TL";
// By default the elements in the movie will not scale in recation to changes in the browser window size
Stage.scaleMode = "noScale";
// ESTO ES LO QUE NO ESTÁ FUNCIONANDO. Estos MC se quedan con su tamaño original
_root.willis_mc._height=Stage.height;
_root.willis_mc._width=_root.willis_mc._height;
// ESTO FUNCIONA
//create a listner that checks to see if the browser window is resized
sizeListener = new Object();
sizeListener.onResize = function() {
// change movieclip properties when the window is resized.
_root.willis_mc._height=Stage.height;
_root.willis_mc._width=_root.willis_mc._height;
};
Stage.addListener(sizeListener);</code>
pseudo
Mil gracias!
Haré lo que decís, pero en cualquier caso es un banner que
1 - cuando llega al final ejecuta un javascript que le hace desaparecer (luego no hace falta borrar el onEnterFrame, no?)
2 - Si no tiene flash 8 se va a mostrar html alternativo (no tengo que hacer entonces nada especial por si el cliente tiene una versión menor
Así que sobretodo me apunto vuestros consejos para la próxima.
Gracias de nuevo y saludos
dourado
BUenaS!
La solución de Mrdoob es buena! :)
Por cierto....Mrdoob vaya animalito de AS3 que eres :D
SaludoS! :)
Usuario desconocido
yo haria algo tal que asi...
<code>
sizeListener = new Object();
sizeListener.onResize = resizeMyStage;
function resizeMyStage() {
_root.willis_mc._height=Stage.height;
_root.willis_mc._width=_root.willis_mc._height;
};
this.onEnterFrame = function() {
if (Stage.width > 100) {
resizeMyStage();
delete this.onEnterFrame;
}
}
</code>
Que en segun que versiones del flash player, no tenias los valores reales del Stage.width/height justo en el 1er frame.
dourado
BUenas!
Te recomendo que si puedes.. "mata" el enterframe.
Algo por ejemplo como:
//la funcion que tengas...
lafuncion = function() {
//pasan cosas...
this.onEnterFrame = undefined;
}
Y mejor si puedes no llegues a utilizarlo. Estarás utilizando demasiados recursos.
Saludos!
pseudo
Yastá
La peli del tuto original solo tiene un frame, la mía no, así que tenía que meter lo que no me funcionaba en un onEnterFrame
:oops: