# AS3 Carousel help

**URL:** <https://forum.kirupa.com/t/as3-carousel-help/234510>\
**Category:** flash\
**Created:** [August 2, 2007, 9:04pm UTC](https://forum.kirupa.com/t/as3-carousel-help/234510 "2007-08-02T21:04:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zero\_chris](https://avatars.discourse-cdn.com/v4/letter/z/ba8739/32.png) [@zero\_chris](https://forum.kirupa.com/u/zero_chris)\
**Post date:** [August 2, 2007, 9:04pm UTC](https://forum.kirupa.com/t/as3-carousel-help/234510/1 "2007-08-02T21:04:08Z")

</div>

Hi,

I have been doing the carousel tutorial by Lee Brimelow from [gotoAndLearn.com](http://gotoAndLearn.com), but have been trying to convert it to AS3.

I have gotten stuck and am hoping someone can help me out.

The problem is I’m trying to place four instances of the clip “item” onto the carousel, four of them are there but they are all in the same position.

you can see the swf and source fla here:  
[http://www.thelightdivided.co.uk/flash/index.html](http://www.thelightdivided.co.uk/flash/index.html)  
[http://www.thelightdivided.co.uk/flash/carousel.fla](http://www.thelightdivided.co.uk/flash/carousel.fla)

The code I have so far is:

[COLOR=“DimGray”]var numOfItems:Number = 4;  
var radiusX:Number = 200;  
var radiusY:Number = 50;  
var centerX:Number = this.stage.stageWidth / 2;  
var centerY:Number = this.stage.stageHeight / 2;  
var speed:Number = 0.02;

var t:item;

// attach icons to the stage  
for (var i = 0; i \< numOfItems; i++) {  
t = new item();  
t.name = “item\_”+i;

```
// place each item equally around the circle
t.angle = i * ((Math.PI*2) / numOfItems);
t.addEventListener(Event.ENTER_FRAME, mover);

// add to stage
addChild(t);

```

}

function mover(evt:Event):void {  
this.x = Math.cos(evt.target.angle) \* radiusX + centerX;  
this.y = Math.sin(evt.target.angle) \* radiusY + centerY;  
var s:Number = this.y / (centerY + radiusY);  
this.scaleY = this.scaleX = s;  
evt.target.angle += this.speed;  
trace(evt.target.name);  
trace(this.x);  
}[/COLOR]

Many thanks  
Chris
