# \[RTS\] draggable square/buildings

**URL:** <https://forum.kirupa.com/t/rts-draggable-square-buildings/177337>\
**Category:** flash\
**Created:** [February 1, 2006, 3:47am UTC](https://forum.kirupa.com/t/rts-draggable-square-buildings/177337 "2006-02-01T03:47:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wats120](https://avatars.discourse-cdn.com/v4/letter/w/7ea924/32.png) [@wats120](https://forum.kirupa.com/u/wats120)\
**Post date:** [February 1, 2006, 3:47am UTC](https://forum.kirupa.com/t/rts-draggable-square-buildings/177337/1 "2006-02-01T03:47:53Z")

</div>

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.clear();  
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);  
}  
updateAfterEvent();  
};  
mouseListener.onMouseUp = function() {  
this.isDrawing = false;  
this.target\_mc = rect\_mc.removeMovieClip("", rect\_mc.getNextHighestDepth());  
};  
Mouse.addListener(mouseListener);

* * *

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) {  
gotoAndStop(2);  
}  
on (releaseOutside) {  
gotoAndStop(1);  
}

frame1=building unselected  
frame2=building selected

is it the (releaseoutside)?
