# Draw box

**URL:** <https://forum.kirupa.com/t/draw-box/173579>\
**Category:** flash\
**Created:** [December 27, 2005, 4:01pm UTC](https://forum.kirupa.com/t/draw-box/173579 "2005-12-27T16:01:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkohne](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@mkohne](https://forum.kirupa.com/u/mkohne)\
**Post date:** [December 27, 2005, 4:01pm UTC](https://forum.kirupa.com/t/draw-box/173579/1 "2005-12-27T16:01:22Z")

</div>

Hello. I have a flash file that draws a box when the user clicks down on the mouse, adjusting the box to any size they need. Here is the code:

```auto
box._visible = false;
box.onMouseDown = function() {
	this._x = _root._xmouse;
	this._y = _root._ymouse;
	this._xscale = this._yscale=0;
	this._visible = true;
	this.onMouseMove = function() {
		this._xscale = _root._xmouse-this._x;
		this._yscale = _root._ymouse-this._y;
		updateAfterEvent();
	};
};
box.onMouseUp = function() {
	delete this.onMouseMove;
	this._visible = true;
};

```

This works fine, but I need the user to be able to create multiple boxes. Right now, after drawing a box, then clicking again it erases the existing box. I also need these boxes that are created to attach themselves to a movie clip. I’ve tried the attachMovie script, but cannot seem to get it to work the way I need it to. Any ideas?
