This seems complete now.
Please feel free to comment.
c = 0;
//1
flag = 1;
//2
createTextField("score", 11, 440, 75, 100, 25);
//3
createTextField("inst", 12, 100, 75, 250, 25);
//4
inst.text = "Click and hold to move up. Leave to move down";
//5
function drawRect(NAME, x, y, w, h, col, depth) {
var rect:MovieClip = _root.createEmptyMovieClip(NAME, depth);
//6
rect._x = x;
//7
rect._y = y;
//8
rect.beginFill(col, 80);
//9
rect.lineTo(w, 0);
//10
rect.lineTo(w, h);
//11
rect.lineTo(0, h);
//12
}
drawRect("upper", 100, 100, 400, 20, 0x000000, 1);
//13
drawRect("lower", 100, 300, 400, 20, 0x000000, 9);
//14
drawRect("player", 125, 150, 25, 25, random(16777215), 8);
//15
drawRect("obstacle", 500, 120+random(120), 20, 60, 0xFF0000, 7);
//16
onEnterFrame = function () {
player._y = player._y<125 ? 125 : player._y>270 ? 270 : player._y+flag*6;
//17
obstacle._x<100 ? drawRect("obstacle", 500, 120+random(120), 20, 60, 0xFF0000, 7) : obstacle._x -= 5;
//18
player.hitTest(obstacle) ? loadMovie("AD_Kirupa_25_Contest_13012004.swf", _root) : score.text="Score: "+(c++);
//19
player.onMouseDown = function() {
flag = -1;
//20
};
player.onMouseUp = function() {
flag = 1;
//21
};
};