Here's the script for the control clip in its entirety:
onClipEvent(enterFrame){
x = (_root._xmouse
- _root.comp._x);
y = (_root._ymouse
- _root.comp._y);
hyp = Math.sqrt(Math.pow(x,2)
+ Math.pow(y,2));
cos = x / hyp;
rad = Math.acos(cos);
deg = Math.floor(180/(Math.PI
/ rad));
if(y < 0){
deg = -deg;
}else if((Math.floor(y)
== 0) && (x < 0)){
deg = 180;
}
}
onClipEvent(mouseDown){
trace("x = "
+ x);
trace("y = "
+ y);
trace("hyp = "
+ hyp);
trace("cos = "
+ cos);
trace("rad = "
+ rad);
trace("deg = "
+ deg);
}
Apply this script to your "comp" movie clip:
//This will
set the rotation value of comp to match the variable clip.deg.
onClipEvent(enterFrame){
this._rotation
= _root.clip.deg;
}
That's it! Still confused? Ask your math professor about it (They'd know better than I would). Later! - Kahlen