# Menu with Rotation Actionscript check

**URL:** <https://forum.kirupa.com/t/menu-with-rotation-actionscript-check/219489>\
**Category:** flash\
**Created:** [March 16, 2007, 10:13pm UTC](https://forum.kirupa.com/t/menu-with-rotation-actionscript-check/219489 "2007-03-16T22:13:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lacohido](https://avatars.discourse-cdn.com/v4/letter/l/e8c25b/32.png) [@lacohido](https://forum.kirupa.com/u/lacohido)\
**Post date:** [March 16, 2007, 10:13pm UTC](https://forum.kirupa.com/t/menu-with-rotation-actionscript-check/219489/1 "2007-03-16T22:13:49Z")

</div>

First off, I’d like to thank Nathan99, pulykamell, mngBJ, and finksmart for helping me through all of this. Props to you guys 🙂

Anyway, I’ve finally completed a prototype of what I’ve been trying to do. You can see it here [http://acohido.com/test.swf](http://acohido.com/test.swf)

I’m putting the code up for critique, as I am a noob and would appreciate any advise concerning this actionscript. Basically, the code works, but i don’t know if this is the preffered method. Again comments and advise are much appreciated. Thanks for all the help guys!!!

```auto

speed=10;
neRotation = [-2,-5,-8,-11,-14];
ogRotation = [0,-3,-6,-9,-12];
sizeSm = (Stage.width/2) -205;
sizeLg = (Stage.width/2) -307;

for (i=0; i<5; i++) {
	_root['swatch'+i]._rotation = 0;
	_root['swatch'+i]._y = 550;
	_root['swatch'+i]._x = (Stage.width/2) -205;
	
	_root['swatch'+i].rotationValue = ogRotation*;
    _root['swatch'+i].onEnterFrame = function() {
        this._rotation += (this.rotationValue-this._rotation)/speed;
	}
	
	_root['swatch'+i].rotationValue2 = neRotation*;
    _root['swatch'+i].onRollOver = function () {
		this.onEnterFrame = function() {
		this._y += (550 -this._y)/speed;
		this._x += (sizeSm -this._x)/speed;
		this._yscale +=(100 -this._yscale)/speed;
		this._xscale +=(100 -this._xscale)/speed;
		this._rotation += (this.rotationValue2-this._rotation)/speed;
		}
	}
	
	_root['swatch'+i].rotationValue3 = ogRotation*;
    _root['swatch'+i].onRollOut = function () {
		this.onEnterFrame = function() {
		this._y += (550 -this._y)/speed;
		this._x += (sizeSm -this._x)/speed;
		this._yscale +=(100 -this._yscale)/speed;
		this._xscale +=(100 -this._xscale)/speed;
		this._rotation += (this.rotationValue3-this._rotation)/speed;
		}
	}
	
	_root['swatch'+i].rotationValue4 = ogRotation*;
    _root['swatch'+i].onPress = function() {
        slideTo(currBtn, 550, sizeSm, currBtn.rotationValue4, 100, 100); 
		currBtn.enabled = true;
		slideTo(this, 300, sizeLg, 0, 150, 150) //{this._rotation += (-30 - this._rotation)/speed;}
        this.enabled = false; 
        currBtn = this;
		
    }
}

function slideTo(mc, ypos, xpos, rot, xscl, yscl) {
    if(mc.onEnterFrame){
        mc.onEnterFrame = null;
    }
    mc.onEnterFrame = function() {
		this._rotation += (rot - this._rotation)/speed;
        this._y += (ypos-this._y)/speed;
		this._x += (xpos-this._x)/speed;
		this._yscale +=(yscl -this._yscale)/speed;
		this._xscale +=(xscl -this._xscale)/speed;
        if(Math.ceil(this._y)==Math.ceil(ypos)){
            this.onEnterFrame = null;
        }
    }
}

```
