This works if you make something like a gun with a big laser scope attached to it and make sure that the central rotation point (the little plus) is in the handle of the gun.
The way it works is it calculates the ratio of the difference in X and Y values, then uses them to make a right triangle. By dividing one by the other and taking the arc-tangent, it produces the angle that the thing needs to be rotated by in radians. Multiply that by [180/Math.PI] and you have it in degrees.
I also had a problem where this would only work if the mouse was to the right of the symbol. The first two "if" statements fix that.
I hope this helps someone! You can use it, but just make sure you tell me so that I know it was useful!
Very nice Which. But all I do is have a missile mc within an empty mc that goes this._x += 5; cause as you rotate it, it will always go forward, because it is going x inside the mc with is whichever direction the missile points(which is the mouse).
geez...tagteamed against me...I mean the thing where there is a movie clip in another and the one inside changes x while the outer one rotates.
I'm sorry, Klaus, maybe I misunderstood it, but that's how it sounded to me. Just a little overcomplicated (no need to triple-team me : (
Also, darkd00m, I was wondering when someone would comment on confusing trigonometry. In this case, my equation makes a right triangle where the hypotenuse (longest side) is a line from the object to the mouse. Then, by using inverse (arc) tangent and dividing one side by the other, I find the angle nearest the object and that tells me how to rotate it.