Sometimes our programs have visual objects that need to be rotated. The default registration point in Flex is the top left corner, but that’s not always ideal. In Flash, we have the freedom to change that registration point — not in Flex.
We have to work around this limitation in Flex and I have seen a few different approaches. There are some blog posts out there that suggest using the Rotate effect, this seems messy to me. If you want to rotate around any point using a MatrixTransformer: Joel Connett has a great post on it here. I quite like that method, but I think I’ve found a more simple solution for center rotation.
Here’s a sample you can play with:
Click Here for Source Code
Try clicking the “show canvas” button, you’ll see a white box that surrounds the bottom right quadrant of the spiral circle. It is only that quarter of the circle which is actually in the canvas. I have placed the center of the circle at the top left corner of the canvas. The canvas will (by default) crop content that exceeds it’s boundaries; however, there is a property on the canvas called “clipContent”. Set that to false and voila.
I know this is really simple solution, but it wasn’t obvious to me until recently. Leave a comment to let me know if this helped to you.
This method works with Flex 2 and Flex 3.