# Carousel buttond are dead

**URL:** <https://forum.kirupa.com/t/carousel-buttond-are-dead/234629>\
**Category:** Uncategorized\
**Created:** [August 3, 2007, 10:42pm UTC](https://forum.kirupa.com/t/carousel-buttond-are-dead/234629 "2007-08-03T22:42:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![peril22](https://avatars.discourse-cdn.com/v4/letter/p/e68b1a/32.png) [@peril22](https://forum.kirupa.com/u/peril22)\
**Post date:** [August 3, 2007, 10:42pm UTC](https://forum.kirupa.com/t/carousel-buttond-are-dead/234629/1 "2007-08-03T22:42:54Z")

</div>

hi all - and hello - first post an all.

I’ve created a carousel menu - looks good and scrolls well- but after importing the graphics and everything I just can’t get the objects to act as buttons - the buttons are created within the objects - and whilst they show the mouseover icon, mouse click just doesn’t work - code is below - men1,men2 ect are movie clip objects. thanks

var gPhase:Number = 0;  
var gDelta:Number;  
var gXamp:Number;  
var gYamp:Number;  
var gXcenter:Number;  
var gYcenter:Number;  
// rate of change  
gDelta = 1;  
// XY amplitude and offset for sin cos equations  
gXamp = 220;  
gXcenter = 800/2;  
gYamp = 15;  
gYcenter = 280;  
\_root.onEnterFrame = function(){  
// rate of change depends on mouse distance from center screen  
// gDelta is 1 when the mouse is at the screen edge and  
// gDelta is 0 at center  
gDelta = (\_root.\_xmouse - (800/2)) / 225;  
// sin and cos uses radians, and 2 PI radian is a full circle  
// basically, gPhase only goes from 0 to 2 for forward rotation and  
// 0 to -2 for reverse rotation  
if(gPhase\<2 && gPhase\>-2){  
gPhase = gPhase + gDelta / 100;  
}  
// otherwise, you reset to 0. just like after 360 degrees, you go  
// back to 0 degrees  
else{  
gPhase=0;  
}

// rotation calculations for position  
// I manually placed the registration point of the  
// objects at the object center so it’ll scale without problems  
// As a review of the “wave” equation,  
// range is -gXamp to gXamp(amplitude)  
// position within rotation is gPhase \* Math.PI  
// offset is gXcenter  
men1.\_x=gXamp_Math.cos(gPhase \* Math.PI) + gXcenter;  
men1.\_y=gYamp_Math.sin(gPhase \* Math.PI) + gYcenter;  
// size calculations  
// The idea with the size calculations is to do smaller  
// amplitudes, but to offset it so that the numbers don’t  
// go into the negative direction  
// 70 is start position, and range is from -30 to 30  
// meaning, the scale changes between 70-30=40 and 70+30=100  
men1.\_xscale=30_Math.sin(gPhase \* Math.PI)+70;  
men1.\_yscale=30_Math.sin(gPhase \* Math.PI)+70;  
men1.swapDepths(Math.round(men1.\_xscale) + 100);

// with the remaining objects, you’ll want to offset the gPhase.  
// A phase difference of 1 means 180 degrees difference.  
// In this case, since 2 is a full circle,  
// we want 2/3 difference because we have 3 objects  
// this is 1/3 of the circle  
men2.\_x=gXamp_Math.cos((gPhase + 6/7) \* Math.PI) + gXcenter;  
men2.\_y=gYamp_Math.sin((gPhase + 6/7)\* Math.PI) + gYcenter;  
men2.\_xscale=30_Math.sin((gPhase + 6/7) \* Math.PI)+70;  
men2.\_yscale=30_Math.sin((gPhase +6/7) \* Math.PI)+70;  
men2.swapDepths(Math.round(men2.\_xscale) + 100);

// (2/3)_2 give it another 1/3 circle difference  
men3.\_x=gXamp_Math.cos((gPhase + (6/7)_2) \* Math.PI) + gXcenter;  
men3.\_y=gYamp_Math.sin((gPhase + (6/7)_2)_ Math.PI) + gYcenter;  
men3.\_xscale=30\*Math.sin((gPhase + (6/7)_2) \* Math.PI)+70;  
men3.\_yscale=30_Math.sin((gPhase +(6/7)\*2) \* Math.PI)+70;  
men3.swapDepths(Math.round(men3.\_xscale) + 100);

men4.\_x=gXamp_Math.cos((gPhase + (6/7)3) \* Math.PI) + gXcenter;  
men4.\_y=gYampMath.sin((gPhase + (6/7)3) Math.PI) + gYcenter;  
men4.\_xscale=30_Math.sin((gPhase + (6/7)_3) \* Math.PI)+70;  
men4.\_yscale=30_Math.sin((gPhase +(6/7)\*3) \* Math.PI)+70;  
men4.swapDepths(Math.round(men4.\_xscale) + 100);

men5.\_x=gXamp_Math.cos((gPhase + (6/7)4) \* Math.PI) + gXcenter;  
men5.\_y=gYampMath.sin((gPhase + (6/7)4) Math.PI) + gYcenter;  
men5.\_xscale=30_Math.sin((gPhase + (6/7)_4) \* Math.PI)+70;  
men5.\_yscale=30_Math.sin((gPhase +(6/7)\*4) \* Math.PI)+70;  
men5.swapDepths(Math.round(men5.\_xscale) + 100);

men6.\_x=gXamp_Math.cos((gPhase + (6/7)5) \* Math.PI) + gXcenter;  
men6.\_y=gYampMath.sin((gPhase + (6/7)5) Math.PI) + gYcenter;  
men6.\_xscale=30_Math.sin((gPhase + (6/7)_5) \* Math.PI)+70;  
men6.\_yscale=30_Math.sin((gPhase +(6/7)\*5) \* Math.PI)+70;  
men6.swapDepths(Math.round(men6.\_xscale) + 100);

men7.\_x=gXamp_Math.cos((gPhase + (6/7)6) \* Math.PI) + gXcenter;  
men7.\_y=gYampMath.sin((gPhase + (6/7)6) Math.PI) + gYcenter;  
men7.\_xscale=30_Math.sin((gPhase + (6/7)_6) \* Math.PI)+70;  
men7.\_yscale=30_Math.sin((gPhase +(6/7)\*6) \* Math.PI)+70;  
men7.swapDepths(Math.round(men7.\_xscale) + 100);  
}
