# stopDrag() after button release

**URL:** <https://forum.kirupa.com/t/stopdrag-after-button-release/217408>\
**Category:** flash\
**Created:** [February 26, 2007, 7:01pm UTC](https://forum.kirupa.com/t/stopdrag-after-button-release/217408 "2007-02-26T19:01:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kredd](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@kredd](https://forum.kirupa.com/u/kredd)\
**Post date:** [February 26, 2007, 7:01pm UTC](https://forum.kirupa.com/t/stopdrag-after-button-release/217408/1 "2007-02-26T19:01:14Z")

</div>

hello all,  
i have a map, [spacebar] + [mouseclick] = dragging the map around - also the word “dragging” appears/disappears so you know you’ve started/stopped. once a building is clicked a “wall” slides up covering the map and that building’s info pops up. wonderful…

if i click a building w/o having dragged the map, then “map dragging” is correctly disabled…BUT…if i drag the map first and THEN click a building i can’t get the ‘map dragging’ to disble (the “wall” is opaque so i can still see the map moving behind it). here is my AS,

```auto
 
var allowDrag:String = "yes"; //initially set to enable dragging
 
 
this.onEnterFrame = function(){ // drag map
if(allowDrag != "no"){ //also tried (allowDrag == "yes")
 var mouseListener:Object = new Object(); //drag map
 if(Key.isDown(Key.SPACE))
  {
   mouseListener.onMouseDown = function()
   {
   _root.map.startDrag();
   _root.dragLight.play();
   setProperty(_root.dragLight,_alpha, 100);
   }
  }
  else // DON'T DRAG!!!
  {
   Mouse.removeListener(mouseListener);
   stopDrag();
   _root.dragLight.stop();
   setProperty(_root.dragLight,_alpha, 0);
   //allowDrag = "no"
  }
  Mouse.addListener(mouseListener);
} // end if allowDrag
// end drag map

```

my building buttons are supposed to set the var to “no” to disable the dragging:

```auto
 
for(var b=1;b<=47;b++){ // loops thru ALL buttons
  _root.map["btn"+b].onRelease = function()
  {
   start_it();
   nozoom = "no";
   allowDrag = "no";// disable map dragging after bldng is clicked
  }
}

```

i can’t see how dragging before or after clicking a building would affect anything?!?! any ideas?

thanks!
