Search code examples
actionscript-3flash

Setting movieclip origin with AS3


I have a spotlight that moves on a stage. Now I rotate the spotlight but its not rotating on the correct point/origin.

I am trying to do something like

myOject.setOrigin = {x , y};
//and then rotate it about x,y.

I have manually set the white circle in the correct place and when I rotate the object with the mouse on the screen it works. Can somebody help me?


Solution

  • Make sure the registration point is in the middle of your symbol. It's not the white circle that appears when you use the Free Transform Tool:

    But the crosshair that appears when you edit your movie clip:

    You can easily center the object by selecting everything, then opening the Align panel and aligning its horizontal and vertical axes to the center using the two "center" icons under the Align section. If your MC has multiple items per layer, group each layer before aligning, then ungroup after aligning: