Ok!
So what I have right now is a pseudo 3D carousel created in Actionscript. I didn't write this though, although I did a little editing for my own purposes.
But now, I found that I need to change this vertical carousel into a horizontal one, which is where I am having trouble.
In the .fla file, the library consists of a movie clip named "mc", with the linkage "mc", and a bitmap image, which is placed inside said movie clip. The movie clip is NOT placed on the stage.
Here is the code for that .fla (on a separate layer):
CODE
import CarouselInverse;
var numOfItems:Number = 10;
var clips:Array = new Array();
for(var i:Number = 0; i < numOfItems; i++)
{
this.attachMovie("mc", "mc" + i, i +1);
var mc:MovieClip = this["mc" + i];
clips.push(mc);
}
var carousel:CarouselInverse = new CarouselInverse(clips);
carousel.radiusX = 200;
onEnterFrame = function()
{
carousel.speed += (_ymouse-Stage.height/2 )*.00015;
carousel.radiusY = (Stage.width/2 - _xmouse)*.15;
carousel.render();
}
This is importing a class named "CarouselInverse", in an .as file named "CarouselInverse.as" with this code:
CODE
class CarouselInverse
{
private var __numOfItems:Number;
private var clips:Array;
public var speed:Number = 0;
public var radiusX:Number=250;
public var radiusY:Number=0;
public var toX:Number=Stage.width/2;
public var toY:Number=Stage.height/2;
public var perspective:Number=0;
function CarouselInverse(clips:Array)
{
this.clips=clips;
__numOfItems=clips.length;
}
public function render()
{
for (var i:Number=0; i < __numOfItems; i++)
{
var __temp:MovieClip=clips[i];
__temp.angle = (i * Math.PI * 2 / __numOfItems) + speed;
__temp._y=Math.cos(__temp.angle) * radiusX + toY;
__temp._x=Math.sin(__temp.angle) * radiusY + toX;
__temp.z = Math.sin(__temp.angle)*100;
var scale:Number = 1/(1-((__temp.z - perspective)/(radiusX-perspective)));
__temp._xscale=__temp._yscale=scale*55;
__temp.swapDepths(Math.round(__temp._xscale + 200));
}
}
public function toArray():Array
{
return clips;
}
}
What I am trying to do is convert that carousel from a vertical one, to a horizontal one! If you can, PLEASE help!
Thanks so much in advance!
This post has been edited by brandon_v: 5 Jun, 2008 - 04:16 AM