0

Currently, I have an objects anchor point set to top left. So if I set object.X = 500, it moves the top left corner 500px in from the edge of the stage.

Now, if I rotate the object 45 degrees for example, the top left corner is still 500px in from the edge, but the bottom right corner is now less than 500 in from the edge.

I want to be able to rotate an image, and amount of degrees, but always keep every point of the object exactly 500px in from the edge.

In my head, I imagine that I need to somehow ignore the anchor point, or something along those lines, but cannot figure out the best way to achieve this.

Can anybody offer any suggestions or insight?

  • Instead of ignoring anchor points, why don't you use the align tool on content inside of these objects so their anchor points are exactly in their centers? – Organis Feb 21 '20 at 17:30
  • Having the anchor point in the centre, would still rotate around that anchor point. I need to be able to rotate the object from ActionScript, without having to rely on any anchor points. It's ok to use an anchor point, as long as once it has been rotated, the distance from the left of the stage to the 'leftmost' pixel on the object, remains the same – AJ Online Services Feb 22 '20 at 17:59
  • Oh, then you should use the **DisplayObject.getBounds(...)** method which answers the "what is the distance between left stage border and the leftmost pixel of this thing" question. Based on that information you can adjust that thing position to make it exactly 500 px you want. https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#getBounds() – Organis Feb 22 '20 at 19:03

0 Answers0