Rotating a crank

I have this nifty crank . . . see cheesy image.

  1. I want to animate this crank so that a user can “grab” the handle w/ the cursor and rotate it lke a real crank around a central axis.

  2. it’ll be used as a navigation tool (forward/back) to scroll images.

  3. added bonus: the faster the crank is spun, the faster the images scroll?

thanks so much for your help!

hondo311

well before i help you can you tell what you already know about the scrooling (is it circular or just up n down or what ever).
is the crank going to be directly based on the srolling ( no easing in?)

"is it circular or just up n down or what ever)."
it is a circular rotation . . . clockwise and counterclockwise. i guess it could be similar to a tutorial i saw online and in the forum

http://actionscript.org/tutorials/advanced/Mouse_Angle_Detection_II/index.shtml

instead of an arrow it will be the crank handle.

"is the crank going to be directly based on the srolling ( no easing in?)"
yes, you turn the crank and the images scroll . . .

i think for it to maake sense they would have to slide like some of those sliding scrollable image strips i’ve seen . . . but based only directly on the crank.

ok
then this will be really easy man.
all you have to do is make the crank handle a button.
then make it rotate based on the angle of the crank simple right?

soo all i did was make the whole crank one mc then the crank handle another mc.
[AS]
//// mc is the whole crank and btn is just the handle btn is inside mc. ball1 and 2 are just object rotation based or rad.
mc.btn.onPress = function(){
scrolling = true;
}
mc.btn.onRelease = function(){
scrolling = false;
}
onEnterFrame = function(){
if(scrolling){
var dx=mc._x-_xmouse;
var dy=mc._y-_ymouse;
var rad = Math.atan2(-dy,-dx);
var angle = (rad*180)/Math.PI;
mc._rotation=angle;
}
ball1._x = 100+Math.cos(rad)*100;
ball1._y = Math.sin(rad)*100;
ball2._x = 100+Math.cos(1+rad)100;
ball2._y = Math.sin(1+rad)100;
}
// soo then if srcolling is circular you can either base it on rad or angle.
/
and if the scroolling is liniar give me one sec i have to think lol
/
[/AS]
heh its that simple but if you want it to ease its will be a little bit more complicated (example 360 = 0 uh-oh!).

ok soo… thats is the code it works vary simple too.
yes its just angle dection and the other objects scroll based on that end result slight some orther variables and such.

with that i made an .fla here ya goo!