[RTS] draggable square/buildings

Part.1-- the square.

i got this code here and i was wondering how you change it to where when you unclick it deletes the box you just drew?

this.createEmptyMovieClip(“rect_mc”, this.getNextHighestDepth());
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
this.isDrawing = true;
this.orig_x = _xmouse;
this.orig_y = _ymouse;
this.target_mc = rect_mc.createEmptyMovieClip("", rect_mc.getNextHighestDepth());
mouseListener.onMouseMove = function() {
if (this.isDrawing) {
this.target_mc.lineStyle(1, 0x333333, 100);
this.target_mc.moveTo(this.orig_x, this.orig_y);
this.target_mc.lineTo(_xmouse, this.orig_y);
this.target_mc.lineTo(_xmouse, _ymouse);
this.target_mc.lineTo(this.orig_x, _ymouse);
this.target_mc.lineTo(this.orig_x, this.orig_y);
mouseListener.onMouseUp = function() {
this.isDrawing = false;
this.target_mc = rect_mc.removeMovieClip("", rect_mc.getNextHighestDepth());

Part.2-- the building.

i have a movieclip with 2 frames and a button in side. the button is a pic of a building. on both frames the buttons actions are

on (release) {
on (releaseOutside) {

frame1=building unselected
frame2=building selected

is it the (releaseoutside)?