# Constraining startDrag() to diagonal line

**URL:** <https://forum.kirupa.com/t/constraining-startdrag-to-diagonal-line/258446>\
**Category:** flash\
**Created:** [April 24, 2008, 2:21am UTC](https://forum.kirupa.com/t/constraining-startdrag-to-diagonal-line/258446 "2008-04-24T02:21:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![herman428](https://avatars.discourse-cdn.com/v4/letter/h/d07c76/32.png) [@herman428](https://forum.kirupa.com/u/herman428)\
**Post date:** [April 24, 2008, 2:21am UTC](https://forum.kirupa.com/t/constraining-startdrag-to-diagonal-line/258446/1 "2008-04-24T02:21:10Z")

</div>

Hi,

So I’m working on a volume slider for a type of jukebox and what I’m using is an actual drawing that is on an angle, therefore the volume slider and handle aren’t in a straight horizontal line.

I’ve done the basic code to keep the handle within the distance of my slider “line” (left to right), but what I have obviously just constrains it to a rectangle.

on(press){  
this.startDrag(false,0,0,32,9);  
}  
on(release){  
this.stopDrag();  
}

The slider and handle are both at actual size, that’s why it’s only 32 pixels wide that I need it to go across and 9 pixels down. I do realize that for what I want, it’s much more involved than this simple startDrag code with 4 sets of numbers in it.

Any help or direction is greatly appreciated. I’m including the source file in Flash 8/Actionscript 2.0.

Thanks.
