Spinning a mc

I’ve rendered out all of the necessary frames view an object a full 360 degrees. What I’m struggling with is code to make my movieclip spin. When I say ‘spin’, I actually mean make the playhead move to make it look like my object is spinning. I would like to use the cursor movement that Canon
(http://consumer.usa.canon.com/ir/controller?act=ModelDetailAct&fcategoryid=114&modelid=7512) uses in there product section which is basically if you move your mouse to the right, the object spins to the right. If you move your mouse to the left it spins the object left. I have seen this effect done on numerous sites, but the code is eluding me. I have been able to make my object spin by pressing a button, but that is only one way…

Thanks in advance…

That’s quite easy. As you see the whole rotation is done by scrolling the mouse from left to right or vice versa. For a range of given _xmouse positions you’ll have a certain frame in your rotation MC. A sample code could look like this (imagine you have let’s say 20 frames of rotation, and the width of the active area is 400 (which in turns means 1 rotation frame per 20 pixels width)


onClipEvent(enterFrame){
 var frameNumber = Math.ceil(_root._xmouse/20+1)
 this.gotoAndStop(frameNumber)
}

Great code!
Couple of questions though - why do you add 1 on the number?
Also, my animation (or object) seems to be spinning in the opposite direction that I’d like it to go.
Thanks in advance…