# Child rotation problem

**URL:** <https://forum.kirupa.com/t/child-rotation-problem/218601>\
**Category:** Uncategorized\
**Created:** [March 9, 2007, 2:55am UTC](https://forum.kirupa.com/t/child-rotation-problem/218601 "2007-03-09T02:55:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![npgames](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/npgames/32/2914_2.png) [@npgames](https://forum.kirupa.com/u/npgames)\
**Post date:** [March 9, 2007, 2:55am UTC](https://forum.kirupa.com/t/child-rotation-problem/218601/1 "2007-03-09T02:55:45Z")

</div>

iv been working with movieclips within movieclips for a while now but im confuzed why this wont work.

this code is on a mc within a mc that i want to be able to rotate in any direction and still have this code work. this code only works when the \_parentclips rotation = 0

onClipEvent (enterFrame) {  
adjside = \_root.hero\_mc.\_x-(\_x + \_parent.\_x);  
oppside = -1\*(\_root.hero\_mc.\_y-(\_y + \_parent.\_y));  
angle = (Math.atan2(oppside, adjside) )  
angle = Math.round(angle/Math.PI_180)  
if(angle - \_parent.\_rotation \> -130)if(angle - \_parent.\_rotation \< -52){  
\_rotation = ((angle_-1) - 90) - \_parent.\_rotation  
}  
}

if i should post the fla, just say so
