# MC WithIn An MC Rotation

**URL:** <https://forum.kirupa.com/t/mc-within-an-mc-rotation/188055>\
**Category:** flash\
**Created:** [May 4, 2006, 5:34am UTC](https://forum.kirupa.com/t/mc-within-an-mc-rotation/188055 "2006-05-04T05:34:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bobocop](https://avatars.discourse-cdn.com/v4/letter/b/0ea827/32.png) [@Bobocop](https://forum.kirupa.com/u/Bobocop)\
**Post date:** [May 4, 2006, 5:34am UTC](https://forum.kirupa.com/t/mc-within-an-mc-rotation/188055/1 "2006-05-04T05:34:30Z")

</div>

I have this code to make tank barrels rotate to mouse possition and It works  
If I use just the barrels.  
But when I put the berrals MC In the tank MC (on top of tank) the code doesn’t work.  
Her’s the code

```auto
_root.onEnterFrame=function(){
xd=_root._xmouse-_root.Barrel7._x;
yd=_root._ymouse-_root.Barrel7._y;
rot=Math.atan2(yd,xd);
toRad=180/Math.PI;
rot*=toRad;
_root.Barrel7._rotation = rot;
}

```

I tried another code for the barrels on the tank but It acts wierd.

I Included the fla file If anyone can help.  
There’s one barrel on stage working good and one barrel on the tank thats not.  
Thanks.
