Loading external images in a spiral pattern

Hi,

I modified a 3D spinning carousel that loads images by an external XML file to give it a 2D circle look. Then I took out all the code for the movement so it would remain stationary, but kept the code to adjust radius etc.

This is great, except now the client would like the icons to be displayed in a spiral instead of a circle. I’m not the greatest when it comes to math, and would appreciate any help you guys could give me in order to get this to work.

What do I need to change or add etc in order to get the images to display in a spiral (say starting in the middle and spiraling out clockwise)? Do I need to add more math in the sin and cos parts? or maybe there is a much simpler way to do this?

I’ve attached a zip file with the .fla, .swf, .xml, and image file.

In the flash file, I have a 600x600 pixel stage with this code on the first frame:



var numOfItems:Number;
var radiusX:Number = 200;
var radiusY:Number = 200;
var centerX:Number = Stage.width / 1.85;
var centerY:Number = Stage.height / 1.62;
var home:MovieClip = this;
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.load("icons.xml");

xml.onLoad = function()
{
	var nodes = this.firstChild.childNodes;
	numOfItems = nodes.length;
	for(var i=0;i<numOfItems;i++)
	{
		var t = home.attachMovie("item","item"+i,i+1);
		t.angle = i * ((Math.PI*2)/numOfItems);
		t.onEnterFrame = mover;
				t.content = nodes*.attributes.content;
		t.icon.inner.loadMovie(nodes*.attributes.image);
		t.r.inner.loadMovie(nodes*.attributes.image);
	}
}

function mover()
{
	this._x = Math.cos(this.angle) * radiusX + centerX;
	this._y = Math.sin(this.angle) * radiusY + centerY;
	this._xscale = this._yscale = 100;
}


Thank you and I appreciate you help!

Hondo311