# 360° product rotation code - need help

**URL:** <https://forum.kirupa.com/t/360-product-rotation-code-need-help/179135>\
**Category:** Uncategorized\
**Created:** [February 16, 2006, 10:24pm UTC](https://forum.kirupa.com/t/360-product-rotation-code-need-help/179135 "2006-02-16T22:24:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hallvalla](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@Hallvalla](https://forum.kirupa.com/u/Hallvalla)\
**Post date:** [February 16, 2006, 10:24pm UTC](https://forum.kirupa.com/t/360-product-rotation-code-need-help/179135/1 "2006-02-16T22:24:24Z")

</div>

I found this nice little control and code on Flashkit that I was wondering if it could be adjusted to control a 360 degree product demo. For now, it spins a 2D movieclip. My product shot movieclip has 36 frames. The thing I like is the adjustable speed and the gradual spinning down - easing - of the movieclip after the cursor is outside the hit area. Is this possible?

I’ve included the original .fla and the .fla file with my movieclip.

[http://homepage.mac.com/hallvalla/sa...tahe-10421.zip](http://homepage.mac.com/hallvalla/sa...tahe-10421.zip)  
[http://homepage.mac.com/hallvalla/sa...uo\_400.fla.zip](http://homepage.mac.com/hallvalla/sa...uo_400.fla.zip)

Any ideas?

I’ve also made a quick 360 vr using some code I found written by senocular (thanks!), to show the product in 360 controlled by mouse position.

[http://homepage.mac.com/hallvalla/rotation/](http://homepage.mac.com/hallvalla/rotation/)

```auto
onClipEvent(load){
	reducer=13;//controls the general speed of rotation.
	brake=0.2;
	frameRate=30;// = Ducument Properties\Frame rate.
}
onClipEvent(enterFrame){
	mousePos={X:_root._xmouse};
	if((320<_root._ymouse)and(_root._ymouse<380)){//wen cursor placed on controlling strip.
		rotation=(mousePos.X-275)/reducer;
		this._rotation+=rotation;
		_root.MCvarTxtSpeed.varTxtSpeed=1/((360/rotation)/frameRate);
		if((360/rotation)/frameRate<0){//not to show negative number at info\One Turn Takes
			_root.MCvarTxtOneTurn.varTxtOneTurn=-(360/rotation)/frameRate;
		}
		else{
		_root.MCvarTxtOneTurn.varTxtOneTurn=(360/rotation)/frameRate;
		}
	}
	else{//if cursor isnt rolling over the strip dont show any info digits:
		if(rotation>0){//slow down the rotation till it stops. i just don know why it neve stops completely!
			rotation=rotation-brake;
			this._rotation+=rotation;  
		}
		if(rotation<0){//slow down the rotation till it stops. i just don know why it neve stops completely!
			rotation=rotation+brake;
			this._rotation+=rotation;
		}
		_root.MCvarTxtSpeed.varTxtSpeed=1/((360/rotation)/frameRate);//
		if((360/rotation)/frameRate<0){//not to show negative number at info\One Turn Takes.
			_root.MCvarTxtOneTurn.varTxtOneTurn=-(360/rotation)/frameRate;
		}else{
			_root.MCvarTxtOneTurn.varTxtOneTurn=(360/rotation)/frameRate;
		}
	}
}
		

```
