智慧 + 毅力 = 无所不能

正确性、健壮性、可靠性、效率、易用性、可读性、可复用性、兼容性、可移植性...

导航

缩放功能

Posted on 2009-12-01 09:40  Bill Yuan  阅读(317)  评论(0编辑  收藏  举报

如果以上命名创建好缩放的组成原件,那么按以下代码就可以实现缩放

 

代码
function mouseMoveHandle(e:MouseEvent):void{
    direction
=e.target.name
    
if (direction.indexOf("U")>=0){
        
if (mouseY<D.y){
            C.height
=C.height+(C.y-mouseY);
            C.y
=UL.y=U.y=UR.y= mouseY;
            L.y
=R.y=(D.y+U.y)/2;
        }
    }
    
if (direction.indexOf("D")>=0){
        
if (mouseY>U.y){
            C.height
=mouseY-C.y;
            DL.y
=D.y=DR.y=mouseY;
            L.y
=R.y=(D.y+U.y)/2;
        }
    }
    
if (direction.indexOf("L")>=0){
        
if (mouseX<R.x){    
            C.width
=C.width+(C.x-mouseX);
            C.x
=UL.x=L.x=DL.x=mouseX;
            D.x
=U.x=(R.x+L.x)/2;
        }
    }
    
if (direction.indexOf("R")>=0){
        
if (mouseX>L.x){     
            C.width
=mouseX-C.x;
            UR.x
=R.x=DR.x=mouseX;
            D.x
=U.x=(R.x+L.x)/2;
        }
    }
    
if (direction=="C"){
        x
=x+mouseX-ox,
        y
=y+mouseY-oy
        ox
=mouseX;       
        ox
=mouseY;    
    }
}