Problema al cargar película
A ver si me podéis ayudar que no doy con el error.
Cargo una película y hasta que redimensiono algunos clips no se me colocan. Sería el logo, direc y menú. Gracias.
escalaFondo();
//Carga swf externo
this.createEmptyMovieClip("menu",200)
menu.loadMovie("menu.swf");
menu._x = Stage.width-150-menu._width;
menu._y = 100;
//Carga clips
galeria.loadMovie("empresa.swf",1000)
this.createEmptyMovieClip("direc",100)
direc.attachMovie("direc","direc",100);
direc._x = 0;
direc._y = 100;
this.createEmptyMovieClip("logo",300)
logo.attachMovie("logo","logo",300);
logo._x = 0;
logo._y = 100;
fondo._x = 0;
fondo._y = 0;
modelo._x = -70;
modelo._y = 0;
var StageWidth:Number = 900;
var StageHeight:Number = 630;
function escalaFondo()
{
modelo._y = Stage.height-modelo._height;
modelo._height = Stage.height;
modelo._xscale = modelo._yscale;
fondo._width = Stage.width;
fondo._height = Stage.height;
fondo._x = (Stage.width/2) - (fondo._width/2);
fondo._y = (Stage.height/2) - (fondo._height/2);
}
function screen_resize()
{
modelo._y = Stage.height-modelo._height;
modelo._height = Stage.height;
modelo._xscale = modelo._yscale;
fondo._width = Stage.width;
fondo._height = Stage.height;
fondo._x = (Stage.width/2) - (fondo._width/2);
fondo._y = (Stage.height/2) - (fondo._height/2);
var _loc3 = Stage.width;
var _loc2 = Stage.height;
var _loc1 = Math.round(_loc3 / 2);
var _loc4 = Math.round(_loc2 / 2);
logo.slideTo(_loc3 - 360, 25, 1);
menu.slideTo(_loc3 - 460, 150, 1);
direc.slideTo(_loc3-205, _loc2 - 30, 1);
}
Stage.align = "TL";
Stage.showMenu = false;
Stage.scaleMode = "noScale";
Stage.addListener(this);
this.onResize = function ()
{
escalaFondo();
screen_resize();
};
screen_resize();
stop ();
lestat
plastikaweb
Muchas gracias por tu respuesta. Voy a probarlo. Saludos.
plastikaweb
Lo primero que te diría es que elimines la función escalaFondo() y toda referencia a ella, tienes el código repetido en screen_resize().
Después registra un objeto y un listener para el evento onResize, y llama a screen_resize() al cargar la película inicialmente así:
Elimina las siguientes lineas:
Stage.addListener(this);
this.onResize = function ()
{
escalaFondo();
screen_resize();
};
screen_resize();
y añade esto:
var stageListener:Object = new Object();
stageListener.onResize = function() {
screen_resize();
};
Stage.addListener(stageListener);
screen_resize();
No he probado tu código, pero prueba primero esto a ver si te funciona.
saludos.