Animation width random startposition

Im a 100% beginner in actionscript so heres my question, as dumb as it may sound.

I want a shape to travel from px 0 on the x-axis to px 740.

The startposition on the y-axis needs to be random, and between
140 and 180.

I have tried the following code:

startY = Math.round(Math.random()*(180-140)+140);
startX = 0;

targetX = 740;
targetY = startY;

_parent._x = startX;
_parent._y = startY;

Any help will be greatly appreciated

onClipEvent(load){
y=Math.random()*40+140;
}
onClipEvent (enterFrame) {
var x=x+1;
this._x=x;
this._y=y;

}
this will work on a clip with timeline 1 frame.
You really don’t need to round it, and you can adjust the speed from 1 to anything you want.
Math.random produces a number between 0 and 1.