Set Registration point in AS3
If you create a Sprite or MovieClip object dynamically in Flash or Flex, there is no method to set the translation point.
You can do this in the Flash development environment. You can dynamically create and set the registration point, to center or any other point on the object.
Here is an easy method call to set the registration point of the MovieClip object.
You can turn on/off the display of the registration point.
Remember to first addChild of the movieclip before calling this method.
To center the registration point, just call the method, and display the registration point call.
setRegistrationPoint( mc, mc.width >> 1, mc.height >> 1, true);
Note: The binary shift operation (mc.width >> 1) is used to get mc's midpoint. It's equivelent to width/2.
To set the registration point to the top right corner of the sprite call.
setRegistrationPoint( mc, mc.width, 0, true);
Move the cursor in the y direction to rotate the MovieClip. The 'x' marks the registration point
I am not an advocate of passing the object I wish to manipulate to a method. Much rather call the method FROM that object.
It's a more natural way of describing and solving a problem.
Ideally the best way to manage this is to call the setRegistration method FROM the object you wish to manipulate,
I know this is a small point in syntax notation, however I strongly believe in being disciplined in this fashion. Problem solving and readability of your code becomes greatly enhanced. Keep your syntax clean and let the language describe what you are solving, the more you deviate away from this, the more Italian we become (spaghetti code)
The original code by eightlines