# Rotation with duplicate movieclips

**URL:** <https://forum.kirupa.com/t/rotation-with-duplicate-movieclips/234704>\
**Category:** Uncategorized\
**Created:** [August 4, 2007, 7:55pm UTC](https://forum.kirupa.com/t/rotation-with-duplicate-movieclips/234704 "2007-08-04T19:55:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tckober](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tckober/32/3687_2.png) [@tckober](https://forum.kirupa.com/u/tckober)\
**Post date:** [August 4, 2007, 7:55pm UTC](https://forum.kirupa.com/t/rotation-with-duplicate-movieclips/234704/1 "2007-08-04T19:55:26Z")

</div>

i found this file a while back (“dynamic\_rotation”) and i would like to rewrite it to place all the code in the \_root on it’s own layer.  
my attempt didn’t quite work how i thought it would ☹  
what am i missing?

the duplicated squares don’t move…

help please!!!

here is the original code on the mc:

onClipEvent (load) {  
y=100;  
Angle\_Inc=12;  
speed=1.5;  
radius=200;  
xcenter=100;  
ycenter=40;  
zcenter=100;  
Per=150;  
angle=0;  
}

onClipEvent (enterFrame) {  
x=Math.cos(angle_Math.PI/180)radius+xcenter;  
z=Math.sin(angleMath.PI/180)radius+zcenter;  
scale=Per/(Per+z);  
\_x=xscale+xcenter;  
\_y=y_scale+ycenter;  
\_xscale=\_yscale=scale\*50;

duplicateMovieClip (this, “ball”+0.1, angle/Angle\_Inc);

angle +=speed;  
if(angle\>359){  
angle -= 360;  
}  
}

here is my code on the actionscript layer:

var fl:Number=150;  
var centerX:Number=100;  
var centerY:Number=40;  
var centerZ:Number=100;  
var angle:Number=0;  
var angleInc:Number=12;  
var speed:Number=1.5;  
var radius:Number=200;  
var count:Number=0;  
var y:Number=100;

onEnterFrame = function(){  
var square:MovieClip = attachMovie(“square”, “square”+ i , angle/angleInc);  
var rad:Number = angle_Math.PI/180;  
x=centerX + Math.cos(rad)radius;  
z=centerZ + Math.sin(rad)radius;  
var scale:Number=fl/(fl+z);  
square.\_xscale=square.\_yscale=scale50;  
square.\_x=centerX + xscale;  
square.\_y=centerY + y_scale;

```
angle +=speed;

if(angle&gt;359){
    angle -= 360;
    }

```

}
