Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/01/2008, 07:24
Motoko
 
Fecha de Ingreso: julio-2005
Mensajes: 90
Antigüedad: 18 años, 9 meses
Puntos: 0
Re: Problemas adaptando un tutorial de un image slider

Lo he solucionado con el siguiente código, ahi queda por si a alguien le sirve:

Código:
var loadListener:Object = new Object();
loadListener.onLoadInit = function(target_mc:MovieClip):Void  {
	adapta_y = 188;
	adapta_x = 268;
	if (target_mc._height > adapta_y || target_mc._width > adapta_x) {
		if (target_mc._height/adapta_y > target_mc._width/adapta_x) {
			prop = target_mc._height/adapta_y; //mas alta que ancha
			target_mc._height = adapta_y;
			target_mc._width = target_mc._width/prop;		
			target_mc._x = target_mc._x + ((target_mc._width/2)); //centrar en anchura
		} else {
			prop = target_mc._width/adapta_x; //mas ancha que alta
			target_mc._height = target_mc._height/prop;
			target_mc._width = adapta_x;
			target_mc._y = target_mc._y + (((target_mc._height/2)/10)*9); //centrar en altura ligeramente desviado hacia arriba
		}
	}
};

var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(loadListener);

/* Loading the images in their appropriate Movie Clips from the folder named as 'images' */

mcLoader.loadClip([url], [movieclip]);
Lo que hace éste código es cargar una imagen en el moviclip que sea, y adaptarla al tamaño adapta_x adapta_y conservando las proporciones de la imagen y centrandola para que no quede todo el hueco debajo o a la derecha de la iamgen.

Un saludo.