I am trying to get a drawn movie clip to rotate to match the movement of the mouse. Here's a silly example that demonstrates what I'm trying to do (without pasting my whole actionscript module):
movieclip.prototype.drawexample = function(sx,sy,fx,fy){
var angle = Math.atan2(sy-fy,sx-fx)*(180/Math.PI);
if (this.Depth == undefined) {
this.Depth = this.getDepth();
}
var t = this.createEmptyMovieClip ("somesymbol"+this.Depth+"_mc", this.Depth);
t.moveto(sx,sy);
t.lineto(15,0); // draw a line along the x-axis
t._rotation = angle; // rotate the line to the mouse pos
}
_root.onMouseMove = function(){
clip.unloadMovie();
clip = drawexample(0,0,_root._mousex,_root.mousey);
}
Shouldn't the clip rotate to the mouse position?
movieclip.prototype.drawexample = function(sx,sy,fx,fy){
var angle = Math.atan2(sy-fy,sx-fx)*(180/Math.PI);
if (this.Depth == undefined) {
this.Depth = this.getDepth();
}
var t = this.createEmptyMovieClip ("somesymbol"+this.Depth+"_mc", this.Depth);
t.moveto(sx,sy);
t.lineto(15,0); // draw a line along the x-axis
t._rotation = angle; // rotate the line to the mouse pos
}
_root.onMouseMove = function(){
clip.unloadMovie();
clip = drawexample(0,0,_root._mousex,_root.mousey);
}
Shouldn't the clip rotate to the mouse position?