flex获取图片旋转后的坐标

public function getRotateXY( obj:DisplayObject, scale:Number, angle:Number ):Point{
var rect:Rectangle = obj.getBounds(parentContainer);
var x:Number = rect.x ;
var y:Number = rect.y ;
if( angle > 0 && angle < 90 )
{
x = rect.x + obj.height *  Math.cos( Math.PI / 180 * (90 - angle) )* scale ;
y = rect.y ;
}else if( angle == 90 ){
x = rect.x + obj.height* scale ;
y = rect.y ;
}else if( angle > 90 && angle < 180 ){
x = rect.x + rect.width ;
y = rect.y + obj.height *  Math.sin( Math.PI / 180 * (angle - 90 ) )* scale ;
}else if( angle == 180 ){
x = rect.x + rect.width ;
y = rect.y + rect.height ;
}else if( angle > 180 && angle < 270 ){
x = rect.x + obj.width *  Math.cos( Math.PI / 180 * ( angle - 180 ) )* scale ;
y = rect.y + rect.height ;
}else if( angle == 270 ){
x = rect.x ;
y = rect.y + rect.height ;
}else if( angle > 270 && angle < 360 ){
x = rect.x ;
y = rect.y + obj.width * Math.sin( Math.PI / 180 * ( 90 - ( angle - 270 ) ) )* scale ;
}
var point:Point = new Point ;
point.x = x ;
point.y = y ;
return point ;
}

你可能感兴趣的:(Flex)