본문 바로가기

Dev/Flash

[AS3.0] 특정점 기준회전 (fl.motion.MatrixTransformer)

▶ 특정점 기준으로 회전

import fl.motion.MatrixTransformer;

var centerX:Number = box.x;
var centerY:Number = box.y;
var mat:Matrix = new Matrix(1,0,0,1, centerX,centerY);

this.stage.addEventListener(MouseEvent.MOUSE_DOWN, stage_mouseDown);
function stage_mouseDown(e:MouseEvent):void {
    centerX = this.mouseX;
    centerY = this.mouseY;
}

this.addEventListener(Event.ENTER_FRAME, this_enterFrame);
function this_enterFrame(e:Event):void {
    MatrixTransformer.rotateAroundExternalPoint(mat, centerX, centerY, 5);
    box.transform.matrix = mat;
}



출처 : 플생사모(늦풀)