pfunc
pfunc

Reputation: 1305

rotating movieclip back to square. AS3

I have a movieclip that I am using greensocks transformManager with so the user can rotate, skew, and scale the clip. This works fine, but I am trying to add a crop tool. If the image is rotated, when I send the image to the crop tool it measures the height of the image by the bounds of the rotated image, not the actual height of the image if it were square (re: not rotated).

So, what I tried to do what, after sending it to the crop tool, rotate it back to 0 before getting the bounds using this code:

var currRot:Number = sourceImg.rotation;


                if(currRot != 0)
                {


                    sourceImg.rotate(Math.abs(currRot));


                }

But what I get traced out is this:

bbefore rotation = -3.7218458499403075 after rotation = 143.0320952700549

I don't understand the math here. Shouldn't it just rotate 3rads in the positive direction to equal it out? How would I return it to 0;

Upvotes: 0

Views: 380

Answers (1)

sharvey
sharvey

Reputation: 8155

You can use sourceImage.getBounds(sourceImage) to get the real size of the object, even after transforming it.

Upvotes: 1

Related Questions