# How to slow speed of a sliding On/Off switch?

**URL:** <https://forum.kirupa.com/t/how-to-slow-speed-of-a-sliding-on-off-switch/296454>\
**Category:** flash\
**Created:** [September 15, 2009, 7:50am UTC](https://forum.kirupa.com/t/how-to-slow-speed-of-a-sliding-on-off-switch/296454 "2009-09-15T07:50:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![megawinks](https://avatars.discourse-cdn.com/v4/letter/m/bc8723/32.png) [@megawinks](https://forum.kirupa.com/u/megawinks)\
**Post date:** [September 15, 2009, 7:50am UTC](https://forum.kirupa.com/t/how-to-slow-speed-of-a-sliding-on-off-switch/296454/1 "2009-09-15T07:50:28Z")

</div>

Hi there,

I’m animating this scene where a sliding On/Off switch responds to mousedrag. I have already constrained its movement to the Y-direction. But now I want to make this movieclip, called “MGAswitch”, to slide at a slower speed instead of the real-time mousedrag speed to simulate friction/resistance. How do I go about doing it?

Here’s my code:

```auto
stop();

var myBoundaries:Rectangle=new Rectangle(431,409.5,0.1,-15);

MGAswitch.addEventListener(MouseEvent.MOUSE_DOWN,dragSwitch);
function dragSwitch(event:MouseEvent):void {
    MGAswitch.startDrag(false,myBoundaries);
     = 1;
}
MGAswitch.addEventListener(MouseEvent.MOUSE_UP,dropSwitch);
function dropSwitch(event:MouseEvent):void {
    MGAswitch.stopDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP,dropSwitch2a);
function dropSwitch2a(event:MouseEvent):void {
    MGAswitch.stopDrag();
}

```

Thanks so much!
