# Scrollbar ... MouseUp. waaaay way from MouseDown

**URL:** https://forum.kirupa.com/t/scrollbar-mouseup-waaaay-way-from-mousedown/289284
**Category:** flash
**Created:** [May 28, 2009, 1:13pm UTC](https://forum.kirupa.com/t/scrollbar-mouseup-waaaay-way-from-mousedown/289284 "2009-05-28T13:13:24Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![BenBart](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@BenBart](https://forum.kirupa.com/u/BenBart)
#### Post date: [May 28, 2009, 1:13pm UTC](https://forum.kirupa.com/t/scrollbar-mouseup-waaaay-way-from-mousedown/289284/1 "2009-05-28T13:13:24Z")

</div>

I have a scroll bar. I want to program it so that if you mouse up anywhere that it stops. (Rather than having to mouse up directly over the scroll bar.) I remember there being a simple solution for this, but I don’t remember what that solution was.

```auto
package
{
    import flash.display.MovieClip
    import flash.geom.Rectangle;
    import flash.events.*;
    
    public class HolmanScrollBar extends MovieClip
    {
        
        
        public function HolmanScrollBar(barHeight:Number, target:MovieClip = null):void
        {
            bar_mc.y = handle_mc.y = upArrow_btn.height+10;
            bar_mc.height = barHeight - (bar_mc.y * 2)
            downArrow_btn.y = bar_mc.y + bar_mc.height + 10 + downArrow_btn.height;
             
            
            handle_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragHandle);
            handle_mc.addEventListener(MouseEvent.MOUSE_UP, stopDragHandle);
            if(target != null)
            {
                
            }
            
            
            
        }
        
        private function dragHandle(e:MouseEvent):void
        {
            handle_mc.startDrag(false, new Rectangle(bar_mc.x+.5, bar_mc.y, 0, bar_mc.height-handle_mc.height));
        }
        
        private function stopDragHandle(e:MouseEvent):void
        {
            handle_mc.stopDrag();
        }
        
    }
    
    
}

```
