A good idea erlenmeyer but not complete. Flash's math objects like radians so you have to translate from degrees to radians. With that way if you only move three pixels to the right you already completed one entire period of the sine curve...so it will move very fast. If you remember that a radian is **not** an angle measure but merely the length of the arc of a unit circle you can find the conversion factor (between degrees and radians) to be PI/180. Here is something you may want to try instead:

Code:

onClipEvent (load)
{
x = 0;
// used for translating between degrees and radians
transe = Math.PI / 180;
}
onClipEvent (enterFrame)
{
this._x = x;
this._y = Math.sin (x * trans);
}

But, that is a little bland and does not have any good features. Let's add a few things. First of all the above will make the movie clip oscillate around the y-axis at the top of the screen...it needs to have a reference point it should occilate around...we will call this "yctr". I will show you the script with all the new features after I talk about them.

Anyway...the next thing you may want to control is the amplitude of the curve. This is done by multiplying the ratio from the sine function by a constant. This constant will represent the maxima and minima that the curve will reach. We will call it "amplitude" (how original).

Also you may want to control the speed at which the curve is drawn. This can be done by taking bigger "steps" when incrementing the "x" variable or draw a couple of points each frame loop. I will use the last way in my script because it looks the best. That variable will be called "speed" and it will only represent how many points to draw each frame loop.

Also how about having the object loop around when it goes off the screen. To do this you will only check if "x" goes greater than you stage width...if it does set "x" to be zero. The screen width will be put in a variable called "screen_x".

Here is the completed script:

Code:

onClipEvent (load)
{
speed = 5;
yctr = 200;
amplitude = 50;
screen_x = 550;
x = 0;
trans = Math.PI / 180;
}
onClipEvent (enterFrame)
{
if (x > screen_x)
x = 0;
for (var j = 0; j < speed; j++)
{
this._x = x;
this._y = yctr - Math.sin (x * trans) * amplitude;
x++;
}
}

But, there are still more ways of manipulating sine curves (or any trigonometric curve for that matter). Go here to learn how to fine tune a sine curve.

Good luck.