# matrixTransformer (bug?) - rotateAroundExternalPoint

**URL:** https://forum.kirupa.com/t/matrixtransformer-bug-rotatearoundexternalpoint/254964
**Category:** flash
**Created:** [March 17, 2008, 7:30pm UTC](https://forum.kirupa.com/t/matrixtransformer-bug-rotatearoundexternalpoint/254964 "2008-03-17T19:30:05Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![brookisme](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@brookisme](https://forum.kirupa.com/u/brookisme)
#### Post date: [March 17, 2008, 7:30pm UTC](https://forum.kirupa.com/t/matrixtransformer-bug-rotatearoundexternalpoint/254964/1 "2008-03-17T19:30:05Z")

</div>

I think there is a bug with the matrixTransformer. I´ve posted code below to illustrate my problem. I was trying to rotate objects about a point and i realized that its not rotating around the correct point. Maybe i´m making a stupid mistake or maybe its a bug… any ideas?

thanks alot, brook  
ps - i tried using “rotateAroundInternalPoint” and that didn´t work either.

--------------------- the code -------------------------------

import fl.motion.MatrixTransformer;  
// “centerX, centerY” gives the center of the system and “Radius” gives the radius  
var centerX:Number = 100;  
var centerY:Number = 100;  
var Radius:Number = 15;  
// this is just a refrence dot so you can see how its messing up  
var center:Sprite = new Sprite();  
center.graphics.beginFill(0);  
center.graphics.drawCircle(centerX,centerY,5);  
center.graphics.endFill();  
addChild(center);  
// here i draw the dots, then call the function to rotate them  
var container:Sprite = new Sprite();  
addChild(container);  
var waitTimer:Timer = new Timer(100 ,11);  
waitTimer.addEventListener(TimerEvent.TIMER,count);  
waitTimer.addEventListener(TimerEvent.TIMER\_COMPLETE,rotate);  
waitTimer.start();  
function count(e:TimerEvent):void {  
var theta:Number = 2 \* Math.PI \* (e.target.currentCount-1) / 10;  
var dotX:Number = centerX + Radius \* Math.sin(theta+Math.PI);  
var dotY:Number = centerY + Radius \* Math.cos(theta+Math.PI);  
var tmp:Sprite = new Sprite;  
tmp.graphics.beginFill(0);  
tmp.graphics.drawCircle(dotX,dotY,2);  
tmp.graphics.endFill();  
container.addChild(tmp);  
}  
// this is the timer that calls the rotation  
function rotate(e:TimerEvent):void {  
var rotTimer:Timer = new Timer(5,5000);  
rotTimer.addEventListener(TimerEvent.TIMER,rotProg);  
rotTimer.start();  
}  
// finally… i call matrixTransformer - you can see it doesn’t rotate around the center  
function rotProg(e:TimerEvent):void {  
var tMatrix:Matrix = container.transform.matrix;  
MatrixTransformer.rotateAroundExternalPoint(tMatrix,centerX,centerY,- 1);  
container.transform.matrix = tMatrix;  
}
