상세 컨텐츠

본문 제목

6강. 돋보기효과의 이미지 만들기

Programming/ActionScript3.0

by 노란날. 2011. 1. 13. 22:55

본문

반응형



big_mc.scaleX = small_mc.scaleX *2;
big_mc.scaleY = small_mc.scaleY *2;

_txt.text = "이미지는" + big_mc.scaleX + "배 입니다.";

big_mc.mask = mask_mc;
mask_mc.startDrag(true);

big_mc.addEventListener(Event.ENTER_FRAME, onEnter);
function onEnter(e:Event):void{
 var mcX:Number = (stage.stageWidth - big_mc.width-0)/(stage.stageWidth - 0)*(mask_mc.x - 0)+0;
 var mcY:Number = (stage.stageHeight - big_mc.height -0)/(stage.stageHeight -0)*(mask_mc.y -0)+0;
 big_mc.x = big_mc.x + (mcX - big_mc.x)*0.3;
 big_mc.y = big_mc.y + (mcY - big_mc.y)*0.3;
 
 border_mc.x = mask_mc.x;
 border_mc.y = mask_mc.y;
}

big_btn.addEventListener(MouseEvent.CLICK, onPlus);
function onPlus(e:MouseEvent):void{
 big_mc.scaleX = big_mc.scaleY += 1;
 _txt.text = "이미지는" + big_mc.scaleX + "배 입니다.";
}

small_btn.addEventListener(MouseEvent.CLICK, onMinus);
function onMinus(e:MouseEvent):void{
 if(big_mc.scaleX > 1 || big_mc.scaleY > 1){
 big_mc.scaleX = big_mc.scaleY -= 1;
 _txt.text = "이미지는" + big_mc.scaleX + "배 입니다.";
 }else{
  _txt.text = "이미지 축소기능은 없습니다."
 }
}

반응형

관련글 더보기