Hi all,

I'm working on an application to play around with images. In which I want to make something like the selection tool in Photoshop. What I want to do is, once the selection tool is selected, for users to click anywhere on the image, this way they start the selection square. The square automatically resizes along with the mouse movement. Once they release the mouse button the square will be fixed and not resize anymore. I've been playing around with it but I can't get it to work. This is what I have;

Code:
this.attachMovie("drag_square", "drag_square", 1000000);
_root.drag_square._visible = false;
_root.child_holder.onMouseDown = function() {
	_root.drag_square._width =0;
	_root.drag_square._height =0;
	_root.drag_square._visible = true;
	_root.drag_square._x = _root.child_holder._x+_root.child_holder._xmouse;
	_root.drag_square._y = _root.child_holder._y+_root.child_holder._ymouse;
};
_root.child_holder.onMouseMove = function() {
	_root.drag_square._width = _root._xmouse-_root.drag_square._x;
	_root.drag_square._height = _root._ymouse-_root.drag_square._y;
};
The problems are;

The square starts anywhere on stage, eventhough I set _root.child_holder.onMouseDown and not Stage.onMouseDown or something.

And the function continues after releasing the mousebutton. is there a function to use in stead of _root.child_holder.onMouseMove, something like
_root.child_holder.onWhileMouseDown?

Cheers