Greetings,
I believe this is esentially a math problem that may be easy for most of the programmers out there, but I am stuck. I have a fixed rectangle width = 50 height = 50 centered in the middle of the stage. I am using this rectangle to copyPixels of a bitmap that is also centered on the stage. The bitmap is draggable. I can define the initial x,y of the rectangle used for copyPixels with
function mouseUpHandler(e:MouseEvent):void
{
…
// initial x,y of centered retangle
cropAreaX = (loaderUI.width/2) - 25;
cropAreaY = (loaderUI.height/2) - 25;
imageBMPData.copyPixels(imageBMP, new Rectangle(cropAreaX,cropAreaY,50,50), new Point(0,0));
…
}
Once the bitmap is dragged in relationship to the fixed rectangle I do not know how to calculate the new x,y(cropAreaX and cropAreaY).
Any help would be greatly appreciated.