Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/10/2009, 10:05
Avatar de Lynxcraft
Lynxcraft
 
Fecha de Ingreso: noviembre-2007
Ubicación: yecla murcia
Mensajes: 1.346
Antigüedad: 16 años, 5 meses
Puntos: 51
Efecto de Lupa Calculo para redimencionar

Hola amigos a ver si me pueden ayudar porque entoy bloqueado con este tema

bueno la cuestión es la siguiente primero tengo este efecto

http://crea-flash.com/temporal/lupa.swf

el problema que dicho efecto es que esta hecho lo mas sencillo posible simplemente multiplico por 2 o 4 respectivamente para encajar las imagen con el tamaño deseado

bueno ahora tengo que modificar modificar el código para que conforme el área que se supone que hace de lupa si crece o se reduzca esta a su ves muestre la imagen ampliada o reducida a la derecha como muestra esta imagen




bueno el codigo del ejemplo anterior es este


Código PHP:
var bimg:Bitmap=new Bitmap(new ropa2(0,0),"auto",true);


if (
bimg.width<bimg.height) {
    var 
h:Number bimg.height;
    
bimg.height =m1.height;
    
bimg.width = (bimg.width*bimg.height/h);
    
bimg.x=-(bimg.width-(m1.width))/2;
} else {
    var 
w:Number bimg.width;
    
bimg.widthm1.width;
    
bimg.height=bimg.height*bimg.width/w;
    
bimg.y=-(bimg.height-(m1.height))/2;
}

var 
bimg2:Bitmap=new Bitmap(new ropa2(0,0),"auto",true);


if (
bimg2.width<bimg2.height) {
    var 
h2:Number bimg2.height;
    
bimg2.height =m1.height*4;
    
bimg2.width = (bimg2.width*bimg2.height/h2);
    
bimg2.x=-(bimg2.width-(m1.width*4))/2;
} else {
    var 
w2:Number bimg2.width;
    
bimg2.widthm1.width*4;
    
bimg2.height=bimg2.height*bimg2.width/w2;
    
bimg2.y=-(bimg2.height-(m1.height*4))/2;
}

m1.mci.addChild(bimg);
m2.mc.addChild(bimg2);

m1.addEventListener(MouseEvent.MOUSE_MOVE,lupa);
function 
lupa(event:MouseEvent):void {
    
m1.m3.x=m1.mouseX;
    
m1.m3.y=m1.mouseY;
    if ((
m1.m3.x-(m1.m3.width/2)) < 0) {
        
m1.m3.=m1.m3.width/2;
    }
    if ((
m1.m3.y-(m1.m3.height/2)) < 0) {
        
m1.m3.=m1.m3.height/2;
    }
    if ((
m1.m3.x+(m1.m3.width/2)) > 325.0) {
        
m1.m3.=325.0-(m1.m3.width/2);
    }
    if ((
m1.m3.y+(m1.m3.height/2)) > 250.0) {
        
m1.m3.=250.0-(m1.m3.height/2);
    }
}

stage.addEventListener(MouseEvent.MOUSE_MOVE,zoom);
function 
zoom(event:MouseEvent):void {
    
m2.mc.x=-(m1.m3.*4)+((m1.m3.width/2)*4);
    
m2.mc.y=-(m1.m3.*4)+((m1.m3.height/2)*4)
    ;


haber si alguno me puede dar algún consegillo de como calcular las áreas

ty
__________________
Sobran las ideas cuando faltan ganas de trabajar en ellas
Lynxcraft