Help with function

Hi,

I dont know so much about actionscript. There is this function called splat which you can view there http://img.stamen.com/drawing/lines_splat.html. The challenge is i need to use this function and constrict it to an area within the stage.

This is the function, the actions on the first frame:

[SIZE=“2”][FONT=“Courier New”][COLOR=“Navy”]function splat(obj, x1, y1, x2, y2, x3, y3, d) {
var _loc3 = obj;
shadow = 1;
_loc3.lineStyle(d, _root.colora, 100);
_loc3.moveTo(x1, y1);
_loc3.curveTo(x3, y3, x2, y2);
dd = Math.sqrt(Math.pow(x2-x1, 2)+Math.pow(y2-y1, 2));
var i = 0;
while (i<Math.floor(5Math.pow(Math.random(), 4))) {
var _loc1 = dd
4*(Math.pow(Math.random(), 2)-5.000000E-001);
var _loc2 = dd4(Math.pow(Math.random(), 2)-5.000000E-001);
var x5 = Math.random()-5.000000E-001;
var y5 = Math.random()-5.000000E-001;
_loc3.lineStyle(d*(5.000000E-001+Math.random()), _root.colora, 100);
_loc3.moveTo(x1+_loc1, y1+_loc2);
_loc3.lineTo(x1+_loc1+x5, y1+_loc2+y5);
++i;
}
// end while
}
// End of the function
var new_size_influence;
var mid_point_push;
var max_line_width;
new_size_influence = Math.floor(Math.random()*20)/10-5.000000E-001;
mid_point_push = Math.floor(Math.random()*8)/4-1;
new_size_influence = 5.000000E-001;
mid_point_push = 7.500000E-001;
max_line_width = Math.random()*50+50;
[/COLOR][/FONT][/SIZE]

There is a movieclip which contains this script:

[SIZE=“2”][FONT=“Courier New”][COLOR=“Navy”]setProperty("", _x, 0);
setProperty("", _y, 0);
var start_x;
var start_y;
var mid_x;
var mid_y;
var end_x;
var end_y;
var parity;
var size;
start_x = mid_x = end_x = Stage.width / 2;
start_y = mid_y = end_y = Stage.height / 2;
parity = false;
size = 0;[/COLOR][/FONT][/SIZE]

This movieclip has these actionscript attached to it:

[SIZE=“2”][FONT=“Courier New”][COLOR=“Navy”]onClipEvent (load) {
_root.colora = random(100000000);
}
onClipEvent (mouseMove)
{
mid_x = (end_x - start_x) * (1 + _parent.mid_point_push) + start_x;
mid_y = (end_y - start_y) * (1 + _parent.mid_point_push) + start_y;
start_x = end_x;
start_y = end_y;
end_x = _xmouse;
end_y = _ymouse;
distance = Math.sqrt(Math.pow(end_x - start_x, 2) + Math.pow(end_y - start_y, 2));
new_size = _parent.max_line_width / distance;
size = _parent.new_size_influence * new_size + (1 - _parent.new_size_influence) * size;
_parent.splat(this, start_x, start_y, end_x, end_y, mid_x, mid_y, size);
}
onClipEvent (mouseDown)
{
_root.colora = “255255255”;
}
onClipEvent (mouseUp)
{
_root.colora = random(100000000);
}[/COLOR][/FONT][/SIZE]