# onClick, spin to front

**URL:** <https://forum.kirupa.com/t/onclick-spin-to-front/246177>\
**Category:** flash\
**Created:** [December 7, 2007, 7:10pm UTC](https://forum.kirupa.com/t/onclick-spin-to-front/246177 "2007-12-07T19:10:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bardic](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bardic/32/3708_2.png) [@bardic](https://forum.kirupa.com/u/bardic)\
**Post date:** [December 7, 2007, 7:10pm UTC](https://forum.kirupa.com/t/onclick-spin-to-front/246177/1 "2007-12-07T19:10:57Z")

</div>

Ok, I am having some probs with my math here.  
I have a carousel and when I click an item I want to bring it to the front and center it. So I have this:

```auto

function mover(){
    this._x = Math.cos(this.angle) * radiusX + Stage.width/2 - radiusX/4;
    this._y = Math.sin(this.angle) * radiusY + centerY;
    var s:Number = this._y / (centerY + radiusY);
    this._xscale = this._yscale = s*100;
    this.swapDepths(Math.round(this._xscale + 100));
        
    if(checked == false){
        this.angle += speed;
        point = 0;
    }else{
       **if(clp._y > point){**      
            for(i=0;i<clpArr.length;i++){    
                if(clp._x > Stage.width/2 - radiusX/4){    
                    clpArr*.angle += 0.15;                    
                }else{                    
                    clpArr*.angle -= 0.15;
                    
                }                
            }    
            point = clp._y;            
        }
    }    
    
    if(this._y < centerY + radiusY/2 + 5){        
        var blurFilter:BlurFilter = new BlurFilter(centerY - this._y+2,centerY - this._y+2,2);
        var myArr:Array = new Array();
        myArr.push(blurFilter);
        this.filters = myArr;
    }else{
        this.filters = null;
    }
}

```

The problem is in the bolded part. I just need to know what hte next increment on y is going to be, but I can’t figure it out.  
What I want is if (clp.\_y - nextStepValue \> point) … I have tried Math.sin(clp.angle) but it didn’t work…

Any ideas? This would be a great help because if I could figure this out this project would be complete for me.

Thanks
