>>> 위치,각도 속성변경 ex
up_btn.addEventListener(MouseEvent.CLICK, onUp);
function onUp(e:MouseEvent):void{
bug_mc.y = bug_mc.y - 1;
bug_mc.rotation = 0;
}
down_btn.addEventListener(MouseEvent.CLICK, onDown);
function onDown(e:MouseEvent):void{
bug_mc.y = bug_mc.y + 1;
bug_mc.rotation = -180;
}
left_btn.addEventListener(MouseEvent.CLICK, onLeft);
function onLeft(e:MouseEvent):void{
bug_mc.x = bug_mc.x - 1;
bug_mc.rotation = 270;
}
right_btn.addEventListener(MouseEvent.CLICK, onRight);
function onRight(e:MouseEvent):void{
bug_mc.x = bug_mc.x + 1;
bug_mc.rotation = 90;
}
>>> scale, alpha, rotation, visible 속성 변경 ex
ro1_btn.addEventListener(MouseEvent.CLICK, onRo1)
function onRo1(e:MouseEvent):void{
camera_mc.rotation += 10;
}
ro2_btn.addEventListener(MouseEvent.CLICK, onRo2)
function onRo2(e:MouseEvent):void{
camera_mc.rotation -= 10;
}
al1_btn.addEventListener(MouseEvent.CLICK, onAl1)
function onAl1(e:MouseEvent):void{
camera_mc.alpha += 0.1;
}
al2_btn.addEventListener(MouseEvent.CLICK, onAl2)
function onAl2(e:MouseEvent):void{
camera_mc.alpha -= 0.1;
}
s1_btn.addEventListener(MouseEvent.CLICK, onS1)
function onS1(e:MouseEvent):void{
camera_mc.scaleX += 0.1;
camera_mc.scaleY += 0.1;
}
s2_btn.addEventListener(MouseEvent.CLICK, onS2)
function onS2(e:MouseEvent):void{
camera_mc.scaleX -= 0.1;
camera_mc.scaleY -= 0.1;
}
visible_btn.addEventListener(MouseEvent.CLICK, onVi)
function onVi(e:MouseEvent):void{
camera_mc.visible =! camera_mc.visible;
}
reset_btn.addEventListener(MouseEvent.CLICK, onRe)
function onRe(e:MouseEvent):void{
camera_mc.alpha = 1;
camera_mc.rotation = 0;
camera_mc.scaleX = 1;
camera_mc.scaleY = 1;
camera_mc.visible = true;
}
3강. 마우스 & 키보드 이벤트 적용하기 (0) | 2010.12.27 |
---|---|
3강. 속성값 적용하기 +@ (0) | 2010.12.27 |
2강. Gallery (0) | 2010.12.27 |
2강. addEventListener (0) | 2010.12.24 |
2강. 함수 (0) | 2010.12.24 |