# How to make a "selection box"?

**URL:** <https://forum.kirupa.com/t/how-to-make-a-selection-box/82264>\
**Category:** Uncategorized\
**Created:** [March 8, 2005, 10:29pm UTC](https://forum.kirupa.com/t/how-to-make-a-selection-box/82264 "2005-03-08T22:29:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![parad0xl0g](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@parad0xl0g](https://forum.kirupa.com/u/parad0xl0g)\
**Post date:** [March 8, 2005, 10:29pm UTC](https://forum.kirupa.com/t/how-to-make-a-selection-box/82264/1 "2005-03-08T22:29:31Z")

</div>

Hello everybody. This is my first post and i hope someone can help me.  
I want to make a box that the user move by the mouse and it can select different objects. Similar when a box appear on a windows desktop if you want to select a set of files or folders.  
I tried to do this using the release event, but i find out a surprise. That the box is drawn at the final of the event, when the user stop to press the mouse button. Maybe, i’m wrong respect the event to use. I put the following code on a big rectangle (the mc) which simulates a desktop space or something

```auto
  
on(press) 
{
 x=_xmouse+_x;
 y=_ymouse+_y;
}
on(release) 
{
_root.createEmptyMovieClip ("square", 1);
 with (_root.square){
 
  lineStyle (5, 0x000000, 100);
  moveTo (x,y);
  lineTo (_xmouse, y);
  lineTo (_xmouse, _ymouse);
  lineTo (x, _ymouse);
  lineTo (x,y);
 }
}

```

thanks for any advice
