# Help - 3D Rotating Gallery - So close!

**URL:** https://forum.kirupa.com/t/help-3d-rotating-gallery-so-close/188524
**Category:** flash
**Created:** [May 8, 2006, 7:36pm UTC](https://forum.kirupa.com/t/help-3d-rotating-gallery-so-close/188524 "2006-05-08T19:36:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mar1b0r0man](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@mar1b0r0man](https://forum.kirupa.com/u/mar1b0r0man)
#### Post date: [May 8, 2006, 7:36pm UTC](https://forum.kirupa.com/t/help-3d-rotating-gallery-so-close/188524/1 "2006-05-08T19:36:22Z")

</div>

Hi all,

Here my attempt at creating the Kirupa’s Spinning Images gallery. Grrr… I’m so ■■■■ close it somewhat works, I’m still having trouble with the rotational calculations. Can some please advise? Not sure, but I think I might be passing the wrong values from the onRelease to the enterFrame loop? Any comments or suggestions are always greatly appreciated, thanks.

//  
var world:Array = [];  
var rotate = 0;  
var fl = 1000;  
var clip;  
//  
function spin()  
{  
for(var i = 0; i \< world.length; i++)  
{  
var w = world\*;  
rotate += (clip.\_x) / 4000;// WRONG VALUE?

var angle = w.angle - rotate;  
var x = Math.cos(angle) \* w.radius;  
var y = w.y;  
var z = Math.sin(angle) \* w.radius;  
//  
var scale = fl / (fl + z);  
w.\_x = x \* scale;  
w.\_y = y \* scale;  
w.\_xscale = w.\_yscale = 100 \* scale;  
w.swapDepths(Math.ceil(-z));  
}  
}  
//  
var thumbsAmt = 4;  
var thumbCount = 0;  
var step = (2 \* Math.PI) / thumbsAmt;  
var loadThumbs = function()  
{  
var th = ‘th’ + thumbCount;  
var w = worldMc.attachMovie(‘thumb’, th, thumbCount);  
w.radius = 200;  
w.angle = step \* thumbCount;  
w.x = Math.cos(w.angle) \* w.radius;  
w.y = 100;  
w.z = Math.sin(w.angle) \* w.radius;  
w.onRelease = function()  
{  
rotate = this.angle; // WRONG VALUE?  
clip = this;  
};  
w.tf.text = thumbCount;  
//  
world.push(w);  
thumbCount++;  
//  
if(thumbCount == thumbsAmt)  
{  
clearInterval(thumbsInterval);  
clip = worldMc.th0;  
worldMc.onEnterFrame = spin;  
}  
};  
//  
var thumbsInterval = setInterval(loadThumbs, 0);
