# Drawing multiple boxes

**URL:** <https://forum.kirupa.com/t/drawing-multiple-boxes/173719>\
**Category:** flash\
**Created:** [December 28, 2005, 11:55pm UTC](https://forum.kirupa.com/t/drawing-multiple-boxes/173719 "2005-12-28T23:55:17Z")\
**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 28, 2005, 11:55pm UTC](https://forum.kirupa.com/t/drawing-multiple-boxes/173719/1 "2005-12-28T23:55:17Z")

</div>

Hello. I need help with drawing multiple boxes. I have the following code:

[AS]var i = 0;  
var therec:MovieClip;  
function drawRec() {  
\_root.createEmptyMovieClip(“therec”, i);  
with (therec) {  
beginFill(0xFFFF00, 50);  
moveTo(sx, sy);  
lineTo(sx, cy);  
lineTo(cx, cy);  
lineTo(cx, sy);  
lineTo(sx, sy);  
endFill();  
}  
}  
someListener = new Object();  
someListener.onMouseDown = function() {  
sx = \_root.\_xmouse;  
sy = \_root.\_ymouse;  
drawing = true;  
};  
someListener.onMouseUp = function() {  
drawing = false;  
};  
someListener.onMouseMove = function() {  
if (drawing) {  
cx = \_root.\_xmouse;  
cy = \_root.\_ymouse;  
drawRec();  
}  
};  
drawing = false;  
Mouse.addListener(someListener);[/AS]

This works, but I need to draw multiple boxes, not just one. I did acomplish this by changing the level in the movie clip to “i++” but this makes the box draw over and upon itself and I lose the transparency that I need. Ideally, I want to draw multiple semi-transparent boxes - like a highlight tool that can be used to mark up documents. I’m assuming that I have to make empty movie clips on multiple levels, but cannot figure out the code for it. Any ideas?
