How to use Actionscript to make an object orbit a point. It has lots of room for embelishments. I tried to keep the code as simple as possible. Assuming you have a "sun" Movie clip and a "planet" Movie clip on the stage, you can make the planet rotate by placing this code on the _root level. myRot = 8; distance = 55; theta = .09; planet.onEnterFrame = function() { t += theta; this._x = sun._x+Math.sin(t)*distance; this._y = sun._y+Math.cos(t)*distance; }; ----------------------------------- Download the fla here... |