var bounds:Rectangle = content.getBounds( this ); var global:Point = new Point( event.stageX, event.stageY ); var local:Point = globalToLocal( global ); // .......... some lines later if( local.x > main.room.width - ( bounds.width + 20 ) && !( local.y > main.room.height - ( bounds.height + 50 ) && content.rotation == 0 ) ) { content.rotation = -90; } else if( local.y > main.room.height - ( bounds.height + 20 ) && !( local.x > main.room.width - ( bounds.width + 50 ) && content.rotation == -90 ) ) { content.rotation = 0; } if( local.x < bounds.width + 20 && !( local.y < bounds.height + 50 && content.rotation == 180 ) ) { content.rotation = 90; } else if( local.y < bounds.height + 20 && !( local.x < bounds.width + 50 && content.rotation == 90 ) ) { content.rotation = 180; }